<?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>Thu, 24 May 2012 18:48:00 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Gaurish Patil's Blog: URL rewriting in Yii to hide index.php]]></title>
      <guid>http://www.phpdeveloper.org/news/17844</guid>
      <link>http://www.phpdeveloper.org/news/17844</link>
      <description><![CDATA[<p>
In <a href="http://gaurishpatil.wordpress.com/2012/04/19/url-rewriting-in-yii-to-hide-index-php/">this new post</a> to his blog <i>Gaurish Patil</i> shows users of the <a href="http://www.yiiframework.com/">Yii framework</a> how they can update their configuration settings to hide the "index.php" in their requests and make cleaner URLs.
</p>
<blockquote>
Finally we figure out the basics of  Yii. While working on basic of Yii, I want to rewrite the url to SEO friendly. So I started to search on google, forum got useful information here http://www.yiiframework.com/doc/guide/1.1/en/topics.url To hide the index.php from url I did changes in config/main.php [...] and I created new .htaccess file in the same directory as my index.php file.
</blockquote>
<p>
The changes are pretty simple - it's mostly a change to the "urlManager" setting to provide some rules for mapping controller and actions to the right place. The .htaccess file uses Apache's mod_rewrite functionality to grab the requested URL and remap it back to lay on top of the "index.php" front controller for the request.
</p>]]></description>
      <pubDate>Fri, 20 Apr 2012 09:27:06 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Sharon Levy's Blog: PHP Version]]></title>
      <guid>http://www.phpdeveloper.org/news/17353</guid>
      <link>http://www.phpdeveloper.org/news/17353</link>
      <description><![CDATA[<p>
<i>Sharon Levy</i> has a new post to her blog showing a trick she's come up with to show the PHP version information (usually found in the <a href="http://php.net/phpinfo">phpinfo</a>) <a href="http://slevy1.wordpress.com/2011/12/12/php-version/#more-2225">even when it's disabled</a>.
</p>
<blockquote>
Sometimes the most crucial, basic piece of information can seem so hard to find. For example, suppose you wanted to find out what version of PHP your remote webhost provides to shared hosting users? What would you do? [...] For development purposes it can be helpful having phpinfo() available, but on a live shared host, you may discover as I did recently that it is no longer available; your host may have disabled it.
</blockquote>
<p>
She includes three other ways you can use to get the version of PHP you're working with:
</p>
<ul>
<li>If you have command line access, running "php -v"
<li>Using the <a href="http://php.net/phpversion">phpversion</a> function (or PHP_VERSION constant)
<li>Appending a certain value to the URL (only works in some cases)
</ul>]]></description>
      <pubDate>Thu, 05 Jan 2012 13:20:40 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Sameer Borate's Blog: Grabbing the referrer search engine keywords for a site]]></title>
      <guid>http://www.phpdeveloper.org/news/17009</guid>
      <link>http://www.phpdeveloper.org/news/17009</link>
      <description><![CDATA[<p>
On his blog today <i>Sameer Borate</i> has a new post with a handy bit of code you can use to <a href="http://www.codediesel.com/php/grabbing-the-referrer-search-engine-keywords-for-a-site/">find the keywords from a search engine referral</a> to help with tracking how visitors have come to your site.
</p>
<blockquote>
A couple of weeks back I had to write a solution for a client to track the referrer search engine from where the user came to his sites contact page, without using Google Analytics. If a user was to fill the contact form on the website, the referring search engine name and the keyword for which it was refereed was to be emailed along with the contact information. The following is a solution for the same.
</blockquote>
<p>
The code itself is pretty simple - it checks the $_SERVER['HTTP_REFERER'] and, based on an array of search engine types, looks for a certain "query" keyname in the URL and matches what follows (with <a href="http://php.net/preg_match">a regular expression</a>). This can be useful for not only determining what sort of audience is visiting your site, but could also be used to present a custom message to visitors from certain search engines (or, more complicated, to show different content based on search terms).
</p>]]></description>
      <pubDate>Tue, 18 Oct 2011 13:25:27 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Lars Tesmer's Blog: How to Unit Test a Class Making Calls to an URL (or the Filesystem) With PHPUnit]]></title>
      <guid>http://www.phpdeveloper.org/news/16889</guid>
      <link>http://www.phpdeveloper.org/news/16889</link>
      <description><![CDATA[<p>
<i>Lars Tesmer</i> has a suggestion for all of the unit testers out there (you do unit test your code, right?) when needing to test a piece of code that makes a call to something on the file system or a remote resource. Their examples come from tests written against the <a href="https://github.com/kriswallsmith/assetic">Assetic</a> codebase.
</p>
<blockquote>
For our most recent <a href="http://lars-tesmer.com/blog/categories/after-work-hacking/">After Work Hacking</a> my co-workers and me decided to write unit tests for the open source project <a href="https://github.com/kriswallsmith/assetic">Assetic</a>. That turned out to be a better decision than our last one, yet we still ran into an interesting challenge.
</blockquote>
<p>
In testing the HttpAsset class from the tool, they came across the problem - a call to a remote/file resource that could not be tested because of a <a href="http://php.net/manual/en/function.file-get-contents.php">file_get_contents</a> call that depends on an external source. They came up with a few options to try to test this example, some better than others:
</p>
<ul>
<li>Give it a real URL to test with
<li>Wrap the file_get_contents inside of a new class (ex. a "ContentFetcher")
<li>Use <a href="https://github.com/mikey179/vfsStream">vfsStream</a> to mock out the file system in the unit test
</ul>
<p>
In their case, vfsStream couldn't be used due to how the fetch call was made, but the tool can be very handy if you need to mock out an external file system resource.
</p>]]></description>
      <pubDate>Wed, 21 Sep 2011 12:04:47 -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[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>
    <item>
      <title><![CDATA[Lorna Mitchell's Blog: Invalid Protected Resource URL in pecl_oauth]]></title>
      <guid>http://www.phpdeveloper.org/news/16180</guid>
      <link>http://www.phpdeveloper.org/news/16180</link>
      <description><![CDATA[<p>
In a quick post to her blog today, <i>Lorna Mitchell</i> talks about <a href="http://www.lornajane.net/posts/2011/Invalid-Protected-Resource-URL-in-Pecl_Oauth">an issue with pecl_outh</a> tat came up during her development of a new API. A strange fatal error message was breaking her connection.
</p>
<blockquote>
I'd gone through all the handshaking steps, got the acces token and was ready to start talking to the service itself. However when I tried to call OAuth::fetch, I got an error message: Fatal error: Uncaught exception 'OAuthException' with message 'Invalid protected resource url, unable to generate signature base string'
</blockquote>
<p>
As it turns out, the issue was obscure - the address she was connecting to was missing a training slash (http://api.localhost versus http://api.localhost/) and it was causing the OAuth fetch to fail (apparently undocumented). If you're interested in some of the other things that have come up in her work with OAuth on the project, <a href="http://www.lornajane.net/plugin/tag/oauth">see here</a>.
</p>]]></description>
      <pubDate>Tue, 12 Apr 2011 10:16:03 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[HashBangCode.com: Revisiting filter_var() and FILTER_VALIDATE_URL]]></title>
      <guid>http://www.phpdeveloper.org/news/16139</guid>
      <link>http://www.phpdeveloper.org/news/16139</link>
      <description><![CDATA[<p>
From the HashBangCode.com site today there's a new post that <a href="http://www.hashbangcode.com/blog/revisiting-filtervar-and-filtervalidateurl-548.html">revisits filtering with the filter_var function</a> included with the language. The focus in this article is specifically in validating URLs with the FILTER_VALIDATE_URL flag.
</p>
<blockquote>
<a href="http://www.hashbangcode.com/blog/php-filter-filtervalidateurl-limitations-111.html">Quite a while ago</a> I looked at using the filter_var() function to validate URL's using the FILTER_VALIDATE_URL flag and someone pointed out recently that this function has not only changed since the initial release, but that a number of flags can be added to change the way that this function works.
</blockquote>
<p>
He lists some of the other flags that are now available that can be used in conjunction with FILTER_VALIDATE_URL to get more fine-grained in your filtering - checks on things like a required scheme, hostname and query string. He includes some code with a set of URLs to run through some tests and output as a table with the pass/fail rank of each URL value. You can see the <a href="http://www.hashbangcode.com/examples/filter_var_url_validate/">resulting output here</a>.
</p>]]></description>
      <pubDate>Mon, 04 Apr 2011 08:44:45 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Derick Rethans' Blog: Short URLs]]></title>
      <guid>http://www.phpdeveloper.org/news/15940</guid>
      <link>http://www.phpdeveloper.org/news/15940</link>
      <description><![CDATA[<p>
<i>Derick Rethans</i> has shared a method he's created for <a href="http://derickrethans.nl/short-urls.html">making short, descriptive URLs</a> with the help of his <a href="http://derickrethans.nl/projects.html#translit">translit</a> PHP extension that translates non-latin characters into latin ones.
</p>
<blockquote>
The URLs for my articles are automatically generated from the title. There is a little function that uses translit's transliterate() function to ASCII-ify the titles. [...] However, [<a href="http://derickrethans.nl/pfcongrez-p2p-konferenciya-phptek-php-vikinger-dpc-and-ez-conference-and-awards.html">this</a>] is hardly a short URL. What we want is something short and descriptive. First of all, I thought it would work to generate short URLs automatically.
</blockquote>
<p>
In hindsight, though, he decided it would just be better to come up with his own short URLs but he still wanted a way to use them. Registering a <a href="http://drck.me/">short domain</a> helped and, along with some &lt;link> tags, made it easier for the right information to be automatically found.
</p>]]></description>
      <pubDate>Tue, 22 Feb 2011 09:44:13 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Brandon Beasley's Blog: Codeigniter Vanity URLs]]></title>
      <guid>http://www.phpdeveloper.org/news/15143</guid>
      <link>http://www.phpdeveloper.org/news/15143</link>
      <description><![CDATA[<p>
On his blog <i>Brandon Beasley</i> has <a href="http://brandonbeasley.com/blog/codeigniter-vanity-urls/">a new tutorial</a> for CodeIgniter users out there on how to create "vanity URLs" that are correctly handled by the framework's routing system.
</p>
<blockquote>
Recently I worked on a CodeIgniter project that needed the ability to use vanity URLs and display stats about the user represented by the URL. For instance, suppose you want to pull all public data on a user from Twitter and display it within your web application on a customized URL such as http://mytwitterapp.com/brandonbeasley .  The difficulty arose when the AUTO setting for URI protocols seemingly failed to handle the PATH_INFO protocol needed for Twitter callbacks and the REQUEST_URI protocol needed for vanity URLs.
</blockquote>
<p>
His solution combines custom routing on the framework side and a bit of a change to the .htaccess to make the APP_PATH functionality work correctly. Then a simple controller can be created (in his case "User") and the username can be pulled in via the URI helper's segment() function. There's other ways to make this happen with the custom routing CodeIgniter offers, but this method allows for a more fine-grained approach.
</p>]]></description>
      <pubDate>Thu, 16 Sep 2010 13:49:01 -0500</pubDate>
    </item>
  </channel>
</rss>

