<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Tue, 22 May 2012 13:04:46 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[PHPMaster.com: REST - Can You do More than Spell It? Part 3]]></title>
      <guid>http://www.phpdeveloper.org/news/17952</guid>
      <link>http://www.phpdeveloper.org/news/17952</link>
      <description><![CDATA[<p>
On PHPMaster.com they've posted <a href="http://phpmaster.com/rest-can-you-do-more-than-spell-it-3/">the third part</a> of their series looking at development around RESTful APIs. In this latest article they take an outsider's perspective and look at using services rather than creating one from scratch. (<a href="http://phpdeveloper.org/news/17881">Part 1</a>, <a href="http://phpdeveloper.org/news/17912">Part 2</a>)
</p>
<blockquote>
Imagine it's a warm, sunny, summer day. You're just walking along, taking a leisurely noonday stroll, when all of a sudden you come face to face with a RESTful API. What do you do? How do you interface with it? Or, as those of us in the know would say, "how do you consume RESTful services?" That, my friends, is the subject of this article.
</blockquote>
<p>
They mention using other tools (like components/features of common frameworks) to interface with the services, but end up using the <a href="http://php.net/curl">curl</a> extension to make  a POST request to a service to add a few events to a "/summerschedule" resource.
</p>]]></description>
      <pubDate>Mon, 14 May 2012 09:41:33 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[XPertDeveloper.com: Get Facebook Page Detail Using Graph API and PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/17338</guid>
      <link>http://www.phpdeveloper.org/news/17338</link>
      <description><![CDATA[<p>
New from the XPertDeveloper.com blog there's a tutorial showing how to <a href="http://www.xpertdeveloper.com/2012/01/facebook-page-detail-using-graph-api-and-php/">use the Facebook graph API to get page details</a> via a simple cURL request (<a href="http://pecl.php.net/curl">cURL PHP support required</a> for the example).
</p>
<blockquote>
Here is the technique to get the detail of the Facebook page with Graph API and PHP. This is the very easy method to get the Facebook page detail. So Let's see how to get this done. With this method you can get details of any Facebook page [inluding] name, picture, link, website, products, description and if the user can post to it.
</blockquote>
<p>
The sample code is only a few lines - it uses the Facebook page ID (easy to grab from the URL) and fetches a URL with it as a parameter. The output is returned as a standard PHP object with all of the properties attached (decoded from JSON). This is just one of many methods the Facebook graph API has, so check out <a href="http://graph.facebook.com">their documentation</a> for more methods and details on returned values.
</p>]]></description>
      <pubDate>Tue, 03 Jan 2012 11:06:04 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Lorna Mitchell's Blog: POSTing JSON Data With PHP cURL]]></title>
      <guid>http://www.phpdeveloper.org/news/17161</guid>
      <link>http://www.phpdeveloper.org/news/17161</link>
      <description><![CDATA[<p>
On her blog today <i>Lorna Mitchell</i> has a quick tip for anyone having an issue sending POSTed JSON data with the <a href="http://php.net/curl">curl</a> functionality that can be built into PHP. The <a href="http://www.lornajane.net/posts/2011/posting-json-data-with-php-curl">trick to her method</a> is sending things with the right header.
</p>
<blockquote>
We can't send post fields, because we want to send JSON, not pretend to be a form (the merits of an API which accepts POST requests with data in form-format is an interesting debate). Instead, we create the correct JSON data, set that as the body of the POST request, and also set the headers correctly so that the server that receives this request will understand what we sent.
</blockquote>
<p>
She includes a code example (about ten lines) showing the POSTing process that sets up options using curl's <a href="http://php.net/curl_setopt">curl_setopt</a>. Be sure to set up the headers to send as "application/json" - that's the trick to letting the remote end know the format.
</p>]]></description>
      <pubDate>Tue, 22 Nov 2011 18:06:48 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Robert Basic's Blog: Benchmarking pages behind a login with ab]]></title>
      <guid>http://www.phpdeveloper.org/news/17124</guid>
      <link>http://www.phpdeveloper.org/news/17124</link>
      <description><![CDATA[<p>
<i>Robert Basic</i> has a recent post showing you how to use the "cookie jar" functionality included with Apache's "ab" benchmarking tool to <a href="http://robertbasic.com/blog/benchmarking-pages-behind-a-login-with-ab/">get behind your PHP-based login</a> with a simple curl and grep combo.
</p>
<blockquote>
Tonight I decided to relax a bit and what better way of relaxing is there for a geek then to do some bash scripting?! So for fun and no profit I decided to try and benchmark pages with <a href="http://httpd.apache.org/docs/2.0/programs/ab.html">ab, Apache HTTP server benchmarking tool</a>, which are behind a login. Turns out, it's pretty easy after reading some man pages.
</blockquote>
<p>
He includes an example of the format of the "cookie jar" and the shell script he used to grab the PHP session ID from it and inject it into the "ab" call. The <a href="https://github.com/robertbasic/blog-examples/tree/master/ab-login">script is on github</a>.
</p>]]></description>
      <pubDate>Mon, 14 Nov 2011 10:12:05 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Gonzalo Ayuso's Blog: Building a client for a REST API with PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/16660</guid>
      <link>http://www.phpdeveloper.org/news/16660</link>
      <description><![CDATA[<p>
<i>Gonzalo Ayuso</i> has a new post to his blog showing how to <a href="http://gonzalo123.wordpress.com/2011/08/01/building-a-client-for-a-rest-api-with-php/">make a PHP-based client for a REST API</a> with the help of <a href="https://github.com/gonzalo123/GzaasApi">his handy tool</a>.
</p>
<blockquote>
Today we're going to create a library to use a simple RESTfull API for a great project called <a href="http://gzaas.com/">Gzaas</a>. [...] Ok. The API is a simple RESTfull <a href="http://gzaas.com/project/api-embed/api-general-overview/">API</a>, so we can use it with a simple curl interface. A few lines of PHP and it will run smoothly. But Gzaas is cool so we're going to create a cool interface too. This days I'm involved into TDD world, so we're going to create the API wrapper using TDD. Let's start.
</blockquote>
<p>
He starts with his tests, defining checks for fonts, patterns and styles and moves into a sample call that sets configuration options for background color, shadows and visibility. You can find out more about what the service has to offer by <a href="http://gzaas.com/project/api-embed">reading the documentation</a> and the client <i>Gonzalo</i> has written for it <a href="https://github.com/gonzalo123/GzaasApi">in github</a>.
</p>]]></description>
      <pubDate>Mon, 01 Aug 2011 11:57:40 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Lorna Mitchell's Blog: ]]></title>
      <guid>http://www.phpdeveloper.org/news/16648</guid>
      <link>http://www.phpdeveloper.org/news/16648</link>
      <description><![CDATA[<p>
<i>Lorna Mitchell</i> has a quick post to her blog today showing how you can use a simple curl call from PHP to <a href="http://www.lornajane.net/posts/2011/Shortening-URLs-from-PHP-with-Bit.ly">shorten urls with bit.ly</a> and pull back the result.
</p>
<blockquote>
I've been looking around for a really simple API that would be a nice place to get started using web services from PHP - and I realised that <a href="http://bit.ly/">bit.ly</a> actually fits the bill really well. They have straightforward <a href="http://code.google.com/p/bitly-api/wiki/ApiDocumentation">api docs</a> on google code, and it's also a pretty simple function!
</blockquote>
<p>
Her code is about three lines consisting of a <a href="http://php.net/curl_init">curl_init</a> call to the bit.ly server with the URL, a <a href="http://php.net/curl_setopt">curl_setopt</a> to tell it to return the information and a <a href="http://php.net/curl_exec">curl_exec</a> to execute. The result is a JSON string easily decoded with a "url" parameter containing the newly minted short URL. She also briefly mentions some of the other features of the bit.ly API including reverse translation and bundling of links.
</p>]]></description>
      <pubDate>Thu, 28 Jul 2011 12:03:02 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Philip Norton's Blog: Netscape HTTP Cooke File Parser In PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/16538</guid>
      <link>http://www.phpdeveloper.org/news/16538</link>
      <description><![CDATA[<p>
<i>Philip Norton</i> has <a href="http://www.hashbangcode.com/blog/netscape-http-cooke-file-parser-php-584.html">shared a script he's created</a> in a new post today that lets you read from a Netscape-formatted cookie file (as outputted from a curl request).
</p>
<blockquote>
This file is generated by PHP when it runs CURL (with the appropriate options enabled) and can be used in subsequent CURL calls. This file can be read to see what cookies where created after CURL has finished running. As an example, this is the sort of file that might be created during a typical CURL call.
</blockquote>
<p>
The file is structured, plain-text content with information on the domain, path, security, name and expiration details of each cookie. His script parses out these details and pushes them into a basic array, prime for searching and sorting (and reuse) in your application. 
</p>]]></description>
      <pubDate>Thu, 30 Jun 2011 09:09:00 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPBuilder.com: PHP Multithreading with cURL]]></title>
      <guid>http://www.phpdeveloper.org/news/16455</guid>
      <link>http://www.phpdeveloper.org/news/16455</link>
      <description><![CDATA[<p>
On PHPBuilder.com <i>Jason Gilmore</i> has posted a new tutorial about how to handle a more true version of multi-threading (non-native, of course) in a PHP application making HTTP requests. His <a href="http://www.phpbuilder.com/columns/Jason_Gilmore06072011.php3">method uses cURL</a>, the popular extension that make working with socket connections a lot simpler.
</p>
<blockquote>
This article explains an alternative solution that consists of sending multiple HTTP requests to the same Web server on which PHP is running. Each HTTP request triggers the execution of a different task. Many requests can be run at the same time without having to wait for each one to finish. [...] As you may know, PHP has no native support for multithreading like Java, but using the cURL extension makes multithreading possible in PHP.
</blockquote>
<p>
He introduces cURL a bit, talking about the protocols it supports and  how to check and see if you have the extension installed. He then walks through a sample connection, calling curl_setopt and curl_exec to fetch a remote page from a website. The real fun comes in when you use the curl_multi_add_handle and curl_multi_exec methods to run more than one request in parallel. 
</p>]]></description>
      <pubDate>Fri, 10 Jun 2011 11:08:58 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Sameer Borate's Blog: Grabbing website Favicons using curl and php]]></title>
      <guid>http://www.phpdeveloper.org/news/16400</guid>
      <link>http://www.phpdeveloper.org/news/16400</link>
      <description><![CDATA[<p>
<i>Sameer Borate</i> has a a new tutorial posted to his blog about <a href="http://www.codediesel.com/php/grabbing-website-favicons-with-curl-php/">grabbing favicons with curl</a> and the help of the Google Shared Stuff API.
</p>
<blockquote>
Google Shared Stuff allows one to easily get the Favicon of any website with a single line. [...] This [curl request] will display the Favicon in the browser. An even more interesting thing we can do is to save the same to a PNG file. 
</blockquote>
<p>
He includes the code to make the curl request to the Google service and save it as the local PNG file. Built on top of this is another script that handles multiple sites (his example uses six different sites), pulls down each of the images and pushes them all together into one. You can <a href="http://www.codediesel.com/wp-content/uploads/2011/05/favicons.gif">see an example here</a>.
</p>]]></description>
      <pubDate>Mon, 30 May 2011 12:52:11 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Martin Sik's Blog: How to "steal" Google's "did you mean" feature]]></title>
      <guid>http://www.phpdeveloper.org/news/16363</guid>
      <link>http://www.phpdeveloper.org/news/16363</link>
      <description><![CDATA[<p>
In <a href="http://www.martinsikora.com/how-to-steal-google-s-did-you-mean-feature">a a new tutorial</a> posted on his blog <i>Martin Sik</i> shows you how to "steal" the "did you mean..." functionality that Google's sites currently offer. His example uses cURL to get the current Google request URLs and fetch the associated results.
</p>
<blockquote>
I really like Google and the classic "did you mean" feature is really great, unfortunately when I wanted to implement it into my project a realized that it's not provided by any of Google's APIs. [...] I believe for most developers [having a large dictionary and extend the dictionary when new terms are available] are unachievable. And so it's for me. So I was thinking if I can bypass these drawbacks and let Google do all the job for me.
</blockquote>
<p>
The source code is included  with the post showing two methods - fetching a "did you mean" block to parse or how a term is attached to a Google URL and the results are returned in JSON and parsed for display. Obviously, this is an external dependency you could consider if you put it into your application, but it can be quite a powerful tool in the right situations.
</p>]]></description>
      <pubDate>Thu, 19 May 2011 12:49:32 -0500</pubDate>
    </item>
  </channel>
</rss>

