<?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>Wed, 22 May 2013 08:31:27 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[PHPMaster.com: Generating One-Time Use URLs]]></title>
      <guid>http://www.phpdeveloper.org/news/19440</guid>
      <link>http://www.phpdeveloper.org/news/19440</link>
      <description><![CDATA[<p>
On PHPMaster.com there's a new tutorial posted showing you how to <a href="http://phpmaster.com/generating-one-time-use-urls/">generate one-time use URLs</a> that could be used for various things across an application, including things like account verification links.
</p>
<blockquote>
A one-time URL is a specially crafted address that is valid for one use only. It's usually provided to a user to gain privileged access to a file for a limited time or as part of a particular activity, such as user account validation. In this article I'll show how to generate, implement, and expire one-time URLs.
</blockquote>
<p>
Included in the post is the SQL to create a sample "pending_users" table that includes a "token" column for storing the generated hash. Code is also included for generating the hash and checking the incoming URL to see if it matches the requested user (and hasn't expired). 
</p>
<blockquote>
As a matter of general house keeping you could write a secondary script to keep expired tokens from accumulating in the database if a user never follows them. The script could be run periodically by an administrator, or preferably set up as a scheduled task or cron job and run automatically.
</blockquote>
Link: http://phpmaster.com/generating-one-time-use-urls]]></description>
      <pubDate>Wed, 10 Apr 2013 11:18:56 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: Building Your Own URL Shortener]]></title>
      <guid>http://www.phpdeveloper.org/news/18506</guid>
      <link>http://www.phpdeveloper.org/news/18506</link>
      <description><![CDATA[<p>
On PHPMaster.com today, there's a new tutorial walking you through the <a href="http://phpmaster.com/building-your-own-url-shortener/">creation of a URL shortner</a> - a simple tool that can be used to compact URLs into something easier to manage (and more friendly with services like Twitter).
</p>
<blockquote>
Most of us are familiar with seeing URLs like bit.ly or t.co on our Twitter or Facebook feeds. These are examples of shortened URLs, which are a short alias or pointer to a longer page link.  [...] In this article you'll learn how to create a fully functional URL shortener for your website that will work whether you use a front controller/framework or not. If you use a front controller, I'll discuss you how to easily integrate this URL shortener without having to dig into the controller's programming.
</blockquote>
<p>
They help you create a simple database to hold the link relationships, the PHP code to create the randomized hash that represents the link and the code to shorten it. There's also the PHP code to take it the other way and decode the shortened version into the full URL. You can find the full code (ready for checkout) over on <a href="https://github.com/phpmasterdotcom/BuildingYourOwnURLShortener">the PHPMaster.com Github account</a>.
</p>]]></description>
      <pubDate>Fri, 21 Sep 2012 12:58:00 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[David M&uuml;ller: Why URL validation with filter_var might not be a good idea]]></title>
      <guid>http://www.phpdeveloper.org/news/18498</guid>
      <link>http://www.phpdeveloper.org/news/18498</link>
      <description><![CDATA[<p>
<i>David M&uuml;ller</i> has a new post to his site today showing why <a href="http://www.d-mueller.de/blog/why-url-validation-with-filter_var-might-not-be-a-good-idea/">validating URLs with filter_var</a> is a good thing for the security of your application.
</p>
<blockquote>
Since PHP 5.2 brought us the filter_var function, the time of such [regular expressions-based] monsters was over. [With] the simple, yet effective syntax [and] with a third parameter, filter flags can be passed, [...] 4 flags are available [for URL filtering].
</blockquote>
<p>
He shows how to use it to filter out a simple <a href="http://en.wikipedia.org/wiki/Cross-site_scripting">XSS</a> issue (a "script" tag in the URL) and some examples of issues that the <a href="http://php.net/filter_var">filter_var</a> function doesn't prevent - like injection of other schemes (like "php://" or "javascript://"). He recommends adding a wrapper around the method to check for the correct scheme (ex. "http" or "https" for URLs) and reminds you that filter_var is not multibyte capable.
</p>]]></description>
      <pubDate>Thu, 20 Sep 2012 08:09:31 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Design Aeon: Check Dead Links From Database Using PHP CURL]]></title>
      <guid>http://www.phpdeveloper.org/news/18105</guid>
      <link>http://www.phpdeveloper.org/news/18105</link>
      <description><![CDATA[<p>
On DesignAeon.com there's a recent tutorial posted showing you how to extract URLs from your database and <a href="http://www.designaeon.com/check-dead-links-from-database-using-php-curl/">determine which ones are "dead"</a> automatically with the help of <a href="http://php.net/curl">cURL</a>.
</p>
<blockquote>
Checking Deadlinks From the database manually is a Headache ,So why not use a script which return the http status of the particular link and tell us if the link is dead or not.So how do we check the dead links from the database ? How do we programatically  check whether the link is dead or not ? To check broken or dead links from Database we will use curl .
</blockquote>
<p>
Included in the post is a <a href="http://www.designaeon.com/check-dead-links-from-database-using-php-curl/">sample script</a> that extracts the URLs from a field in the database (you'd need some extra smarts if you're pulling it from content) and running it though a "checklink" function. If the call to <a href="http://php.net/curl_getinfo">curl_getinfo</a> returns false, the link is marked dead.
</p>]]></description>
      <pubDate>Mon, 18 Jun 2012 09:45:55 -0500</pubDate>
    </item>
    <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[Lorna Mitchell's Blog: Building A RESTful PHP Server: Routing the Request]]></title>
      <guid>http://www.phpdeveloper.org/news/17433</guid>
      <link>http://www.phpdeveloper.org/news/17433</link>
      <description><![CDATA[<p>
<i>Lorna Mitchell</i> is back with a second installment in her "Building a RESTful PHP Server" series with <a href="http://www.lornajane.net/posts/2012/building-a-restful-php-server-routing-the-request">this new post</a> about handling and routing the incoming requests. (You can find the first part about working with the request <a href="http://phpdeveloper.org/news/17418">here</a>)
</p>
<blockquote>
This is the second part of a series, showing how you might write a RESTful API using PHP. This part covers the routing, autoloading, and controller code for the service, and follows on from the first installment which showed how to parse the incoming request to get all the information you need.
</blockquote>
<p>
She shows how to grab the controller name from the incoming request (based on her previous code), create the object for it and execute the requested action name. Also included is a sample autoloader and a basic controller - a UsersController with "getAction" and "postAction" 
 methods for responding to GET and POST requests.
</p>]]></description>
      <pubDate>Mon, 23 Jan 2012 11:14:11 -0600</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[PHPBuilder.com: Building RESTful APIs with the Slim Microframework]]></title>
      <guid>http://www.phpdeveloper.org/news/16958</guid>
      <link>http://www.phpdeveloper.org/news/16958</link>
      <description><![CDATA[<P>
On PHPBuilder.com today there's a new tutorial from <i>Jason Gilmore</i> about building a <a href="http://www.phpbuilder.com/columns/RESTfulAPIs/RESTfulAPIs_10-04-2011.php3">simple RESTful API with Slim</a>, a microframework for PHP.
</p>
<blockquote>
Although a relatively new entrant in the PHP framework sweepstakes, I've been lately quite intrigued by <a href="https://github.com/codeguy/Slim">Slim</a>, a slick RESTful microframework modeled after Ruby's <a href="http://www.sinatrarb.com/">Sinatra</a>, which is coincidentally by far <a href="http://www.developer.com/lang/rubyrails/building-an-ajax-friendly-rest-api-with-sinatra.html">my favorite microframework</a> available for any programming language. In this article I'll show you just how easy it is to get started building a powerful RESTful API using this streamlined framework.
</blockquote>
<p>
Setup of the framework is as simple as downloading the latest copy from <a href="https://github.com/codeguy/Slim">its github repository</a>. It can then be included and used to make the simple routes in his examples. He uses a "games" request type to show how to handle GET, POST and PUT requests through Slim's simple interface.
</p>]]></description>
      <pubDate>Thu, 06 Oct 2011 10:12:07 -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>
  </channel>
</rss>
