<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Today I Searched &#187; PHP</title>
	<atom:link href="http://www.todayisearched.com/category/php/feed" rel="self" type="application/rss+xml" />
	<link>http://www.todayisearched.com</link>
	<description>...And Found Awesomeness</description>
	<lastBuildDate>Fri, 20 Jan 2012 02:17:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Gravatar WordPress Comments</title>
		<link>http://www.todayisearched.com/2012/01/gravatar-wordpress-comments.html</link>
		<comments>http://www.todayisearched.com/2012/01/gravatar-wordpress-comments.html#comments</comments>
		<pubDate>Fri, 20 Jan 2012 02:17:46 +0000</pubDate>
		<dc:creator>michaelafowler</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[gravatar]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.todayisearched.com/?p=215</guid>
		<description><![CDATA[Today I searched gravatar wordpress comments trying to figure how to get the gravatar images next to the comments in a wordpress.org theme. I was surprised to find that wordpress natively supports gravatars in 2.5 and above. To use it you just call get_avatar and pass in the email and an optional size and it [...]]]></description>
			<content:encoded><![CDATA[<div class='dd_post_share dd_post_share_left'><div class='dd_buttons'><div class='dd_button'><iframe src='http://widgets.dzone.com/links/widgets/zoneit.html?url=http%3A%2F%2Fwww.todayisearched.com%2F2012%2F01%2Fgravatar-wordpress-comments.html&amp;title=Gravatar%20Wordpress%20Comments&amp;t=1' height='70' width='50' frameborder='0' scrolling='no'></iframe></div><div class='dd_button'><script type='text/javascript' src='https://apis.google.com/js/plusone.js'></script><g:plusone size='tall' href='http://www.todayisearched.com/2012/01/gravatar-wordpress-comments.html'></g:plusone></div><div class='dd_button'><iframe src='http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.todayisearched.com%2F2012%2F01%2Fgravatar-wordpress-comments.html&amp;locale=en_US&amp;layout=standard&amp;action=like&amp;width=350&amp;height=24&amp;colorscheme=light' scrolling='no' frameborder='0' style='border:none; overflow:hidden; width:500px; height:24px;' allowTransparency='true'></iframe></div></div></div><p>Today I searched <strong>gravatar wordpress comments</strong> trying to figure how to get the gravatar images next to the comments in a wordpress.org theme. I was surprised to find that <a href="http://codex.wordpress.org/Using_Gravatars" target="_blank">wordpress natively supports gravatars in 2.5</a> and above. To use it you just call get_avatar and pass in the email and an optional size and it spits out the image html. Once I found the loop of comments in the template code, I just added the below code in a div next to the comment text. </p>
<p><textarea name="code" class="php" cols="60" rows="10"><?php echo get_avatar($comment->comment_author_email, &#8220;55&#8243;) ?></textarea></p>
<p>I used comment_author_email on the php comment object to get the email address of the person who made the comment. It was pretty painless to do and a great feature to add to my template.</p>
<!-- Social Buttons Generated by Digg Digg plugin v4.5.3.4, 
    Author : Yong Mook Kim
    Website : http://www.diggdigg2u.com -->]]></content:encoded>
			<wfw:commentRss>http://www.todayisearched.com/2012/01/gravatar-wordpress-comments.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP 301 Redirect</title>
		<link>http://www.todayisearched.com/2012/01/php-301-redirect.html</link>
		<comments>http://www.todayisearched.com/2012/01/php-301-redirect.html#comments</comments>
		<pubDate>Tue, 17 Jan 2012 13:20:37 +0000</pubDate>
		<dc:creator>michaelafowler</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[301 Redirect]]></category>

		<guid isPermaLink="false">http://www.todayisearched.com/?p=205</guid>
		<description><![CDATA[Today I searched PHP 301 Redirect and I found that it was very simple. All you need to do is add this code to the header of the the php page. Then you just change &#8220;http://www.new-url.com&#8221; to the url you want the page to get redirect to. Once that is done you have successfully redirected [...]]]></description>
			<content:encoded><![CDATA[<div class='dd_post_share dd_post_share_left'><div class='dd_buttons'><div class='dd_button'><iframe src='http://widgets.dzone.com/links/widgets/zoneit.html?url=http%3A%2F%2Fwww.todayisearched.com%2F2012%2F01%2Fphp-301-redirect.html&amp;title=PHP%20301%20Redirect&amp;t=1' height='70' width='50' frameborder='0' scrolling='no'></iframe></div><div class='dd_button'><script type='text/javascript' src='https://apis.google.com/js/plusone.js'></script><g:plusone size='tall' href='http://www.todayisearched.com/2012/01/php-301-redirect.html'></g:plusone></div><div class='dd_button'><iframe src='http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.todayisearched.com%2F2012%2F01%2Fphp-301-redirect.html&amp;locale=en_US&amp;layout=standard&amp;action=like&amp;width=350&amp;height=24&amp;colorscheme=light' scrolling='no' frameborder='0' style='border:none; overflow:hidden; width:500px; height:24px;' allowTransparency='true'></iframe></div></div></div><p>Today I searched <strong>PHP 301 Redirect</strong> and I found that it was very simple. All you need to do is add this code to the header of the the php page.<br />
<textarea name="code" class="php" cols="60" rows="10"><?  Header( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: http://www.new-url.com" ); ?></textarea ></p>
<p>Then you just change &#8220;http://www.new-url.com&#8221; to the url you want the page to get redirect to. Once that is done you have successfully redirected a page using a 301 redirect.</p>
<!-- Social Buttons Generated by Digg Digg plugin v4.5.3.4, 
    Author : Yong Mook Kim
    Website : http://www.diggdigg2u.com -->]]></content:encoded>
			<wfw:commentRss>http://www.todayisearched.com/2012/01/php-301-redirect.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multi Select PHP</title>
		<link>http://www.todayisearched.com/2011/09/multi-select-php.html</link>
		<comments>http://www.todayisearched.com/2011/09/multi-select-php.html#comments</comments>
		<pubDate>Thu, 29 Sep 2011 20:48:51 +0000</pubDate>
		<dc:creator>michaelafowler</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[webdesign]]></category>

		<guid isPermaLink="false">http://www.todayisearched.com/?p=158</guid>
		<description><![CDATA[Today I searched multi select php to find out how php handled the passing of this input field. I found out that you need add the square brackets to the end of the name value of your select element for PHP to pick up all of the values in an array. Below is an example [...]]]></description>
			<content:encoded><![CDATA[<div class='dd_post_share dd_post_share_left'><div class='dd_buttons'><div class='dd_button'><iframe src='http://widgets.dzone.com/links/widgets/zoneit.html?url=http%3A%2F%2Fwww.todayisearched.com%2F2011%2F09%2Fmulti-select-php.html&amp;title=Multi%20Select%20PHP&amp;t=1' height='70' width='50' frameborder='0' scrolling='no'></iframe></div><div class='dd_button'><script type='text/javascript' src='https://apis.google.com/js/plusone.js'></script><g:plusone size='tall' href='http://www.todayisearched.com/2011/09/multi-select-php.html'></g:plusone></div><div class='dd_button'><iframe src='http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.todayisearched.com%2F2011%2F09%2Fmulti-select-php.html&amp;locale=en_US&amp;layout=standard&amp;action=like&amp;width=350&amp;height=24&amp;colorscheme=light' scrolling='no' frameborder='0' style='border:none; overflow:hidden; width:500px; height:24px;' allowTransparency='true'></iframe></div></div></div><p>Today I searched <strong>multi select php</strong> to find out how php handled the passing of this input field. I found out that you need add the square brackets to the end of the name value of your select element for PHP to pick up all of the values in an array. Below is an example of the code:</p>
<h3>The Multiple Select Box</h3>
<select name="selectData[]" multiple="multiple">
<option value="1">Today</option>
<option value="2">I</option>
<option value="3">Searched</option>
</select>
<h3>The HTML</h3>
<pre name="code" class="html">
<select name="selectData[]" multiple="multiple">
<option value="1">Today</option>
<option value="2">I</option>
<option value="3">Searched</option>
</select>
</pre>
<h3>The PHP</h3>
<pre name="code" class="php">
	$selectData=$_POST['selectData'];
	if ($selectData){
	    foreach ($selectData as $sd){
               echo 'Selected Value '.$sd;
            }
	}
</pre>
<!-- Social Buttons Generated by Digg Digg plugin v4.5.3.4, 
    Author : Yong Mook Kim
    Website : http://www.diggdigg2u.com -->]]></content:encoded>
			<wfw:commentRss>http://www.todayisearched.com/2011/09/multi-select-php.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Make AJAX Call To A Different Domain Using PHP &amp; JQuery</title>
		<link>http://www.todayisearched.com/2010/05/make-ajax-call-to-a-different-domain-using-php-jquery.html</link>
		<comments>http://www.todayisearched.com/2010/05/make-ajax-call-to-a-different-domain-using-php-jquery.html#comments</comments>
		<pubDate>Tue, 11 May 2010 13:26:29 +0000</pubDate>
		<dc:creator>pzeppy</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[ajax]]></category>

		<guid isPermaLink="false">http://www.todayisearched.com/?p=107</guid>
		<description><![CDATA[Today I Searched how to make an AJAX call to a URL on a different domain. My first attempt failed with a security error. I dug into the problem a bit and found out that PHP can be used as a proxy to fetch the web content. AJAX Calls PHP Script On Your Domain -> [...]]]></description>
			<content:encoded><![CDATA[<div class='dd_post_share dd_post_share_left'><div class='dd_buttons'><div class='dd_button'><iframe src='http://widgets.dzone.com/links/widgets/zoneit.html?url=http%3A%2F%2Fwww.todayisearched.com%2F2010%2F05%2Fmake-ajax-call-to-a-different-domain-using-php-jquery.html&amp;title=Make%20AJAX%20Call%20To%20A%20Different%20Domain%20Using%20PHP%20%26%20JQuery&amp;t=1' height='70' width='50' frameborder='0' scrolling='no'></iframe></div><div class='dd_button'><script type='text/javascript' src='https://apis.google.com/js/plusone.js'></script><g:plusone size='tall' href='http://www.todayisearched.com/2010/05/make-ajax-call-to-a-different-domain-using-php-jquery.html'></g:plusone></div><div class='dd_button'><iframe src='http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.todayisearched.com%2F2010%2F05%2Fmake-ajax-call-to-a-different-domain-using-php-jquery.html&amp;locale=en_US&amp;layout=standard&amp;action=like&amp;width=350&amp;height=24&amp;colorscheme=light' scrolling='no' frameborder='0' style='border:none; overflow:hidden; width:500px; height:24px;' allowTransparency='true'></iframe></div></div></div><p><strong>Today I Searched how to make an AJAX call to a URL on a different domain</strong>.  My first attempt failed with a security error.  I dug into the problem a bit and found out that PHP can be used as a proxy to fetch the web content.</p>
<p>AJAX Calls PHP Script On Your Domain -> PHP Script Fetches Content From Remote Domain -> PHP Script Returns The Remote Data Back To The AJAX Call</p>
<p>Below is a sample PHP script that I found and tweaked.</p>
<pre name="code" class="php">
// Set your return content type
header('Content-type: text/html');

// Website url to open
$daurl = 'http://www.otherdomain.com/index.php?sku=' . $_GET["sku"];

// Get that website's content
$handle = fopen($daurl, "r");

// If there is something, read and return
if ($handle) {
    while (!feof($handle)) {
        $buffer = fgets($handle, 4096);
        echo $buffer;
    }
    fclose($handle);
}
</pre>
<p>Below is the AJAX call to load the content into a div using JQuery</p>
<pre name="code" class="javascript">
$("#loadremotecontent").load('getprice.php?sku=322000');
</pre>
<p>The script could be further modified to pass in the entire URL as a parameter so it could be more generic.  I would love to hear about other cross domain AJAX options if anyone has any other suggestions.</p>
<!-- Social Buttons Generated by Digg Digg plugin v4.5.3.4, 
    Author : Yong Mook Kim
    Website : http://www.diggdigg2u.com -->]]></content:encoded>
			<wfw:commentRss>http://www.todayisearched.com/2010/05/make-ajax-call-to-a-different-domain-using-php-jquery.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP Geo IP Address Lookup</title>
		<link>http://www.todayisearched.com/2010/02/php-geo-ip-address-lookup.html</link>
		<comments>http://www.todayisearched.com/2010/02/php-geo-ip-address-lookup.html#comments</comments>
		<pubDate>Mon, 08 Feb 2010 15:51:17 +0000</pubDate>
		<dc:creator>pzeppy</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[affiliates]]></category>
		<category><![CDATA[geoip]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.todayisearched.com/?p=70</guid>
		<description><![CDATA[Today I searched on how to get the city of a user based on their ip address. I was looking to do this using PHP and preferably for free. There was quiet a bit out there that had a free database you could download to cross reference that would return the country. However, we wanted [...]]]></description>
			<content:encoded><![CDATA[<div class='dd_post_share dd_post_share_left'><div class='dd_buttons'><div class='dd_button'><iframe src='http://widgets.dzone.com/links/widgets/zoneit.html?url=http%3A%2F%2Fwww.todayisearched.com%2F2010%2F02%2Fphp-geo-ip-address-lookup.html&amp;title=PHP%20Geo%20IP%20Address%20Lookup&amp;t=1' height='70' width='50' frameborder='0' scrolling='no'></iframe></div><div class='dd_button'><script type='text/javascript' src='https://apis.google.com/js/plusone.js'></script><g:plusone size='tall' href='http://www.todayisearched.com/2010/02/php-geo-ip-address-lookup.html'></g:plusone></div><div class='dd_button'><iframe src='http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.todayisearched.com%2F2010%2F02%2Fphp-geo-ip-address-lookup.html&amp;locale=en_US&amp;layout=standard&amp;action=like&amp;width=350&amp;height=24&amp;colorscheme=light' scrolling='no' frameborder='0' style='border:none; overflow:hidden; width:500px; height:24px;' allowTransparency='true'></iframe></div></div></div><p><strong>Today I searched on how to get the city of a user based on their ip address. </strong> I was looking to do this using PHP and preferably for free.  There was quiet a bit out there that had a free database you could download to cross reference that would return the country.  However, we wanted to be able to get the city and state as well.  After quiet a bit of googling, I came across a <a href="http://www.ipgp.net/developer-tools/" target="_blank">free API from ipgp.net</a>.  They allow you to post the ip to a URL and they return an XML packet with the county, a path to the image of the country&#8217;s flag, city, state, isp, latitude, and longitude.  They have an example on how to do this on their page.  We created our own class below for your use that is a little cleaner.  It can be included in your php scripts and you don&#8217;t have to worry about downloading anything into MySQL.</p>
<pre name="code" class="php">	/*
		Provided by http://www.todayisearched.com
	*/
	class GeoIP {

		/*
			Returns all possible Geo Ip information in an associative array.  The following pieces of information
			are returned:
			IP - IP ADDRESS LOOKED UP
			CODE - COUNTRY CODE
			COUNTY - COUNTRY NAME
			FLAG - PATH TO IMAGE OF THE COUNTRY'S FLAG
			CITY - CITY NAME
			REGION - STATE NAME
			ISP - ISP NAME
			LAT - LATITUDE CORDINATE
			LNG - LONGITUDE CORDINATE

			USAGE:
			$ipinfo = GeoIP :: getGeoArray('xxx.xxx.xxx.xxx');
			echo $ipinfo['CITY'] . ', ' . $ipinfo['STATE'];
		*/
		public static function getGeoArray($ip) {
			$file = "http://www.ipgp.net/api/xml/". $ip;

			$xml_parser = xml_parser_create();
			$fp = fopen($file, "r");
			$data = fread($fp, 80000);
			xml_parse_into_struct($xml_parser, $data, $vals);
			$iplookup = array();
			foreach ($vals as $v) {
				if (isset($v['tag']) &amp;&amp; isset($v['value'])) {
					$iplookup[$v['tag']] = $v['value'];
				}
			}
			xml_parser_free($xml_parser);
			fclose($fp);

			return $iplookup;
		}

		//shortcut to get the city name
		public static function getCity($ip) {
			$a =  self :: getGeoArray($ip);
			return $a['CITY'];
		}

		//shortcut to get the state name
		public static function getState($ip) {
			$a =  self :: getGeoArray($ip);
			return $a['REGION'];
		}

	}</pre>
<p>Follow these steps to implement the above script:</p>
<ol>
<li>Copy the script above and save it into a php file on your server</li>
<li>Add include_once(&#8216;Path To The PHP File Saved On #1&#8242;);</li>
<li>Use the code snippet below in your php to obtain geoip information.</li>
</ol>
<pre name="code" class="php">
      include_once "geoip.php";
      $ipinfo = GeoIP :: getGeoArray($_SERVER['REMOTE_ADDR']);
      echo 'Hello, Your City And State Is ' . $ipinfo['CITY'] . ', ' . $ipinfo['REGION'];
</pre>
<p>Thanks <a href="http://www.ipgp.net" target="_blank">http://www.ipgp.net</a> for providing this invaluable service!</p>
<!-- Social Buttons Generated by Digg Digg plugin v4.5.3.4, 
    Author : Yong Mook Kim
    Website : http://www.diggdigg2u.com -->]]></content:encoded>
			<wfw:commentRss>http://www.todayisearched.com/2010/02/php-geo-ip-address-lookup.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: www.todayisearched.com @ 2012-02-05 14:21:10 -->
