<?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>Living In Minnesota &#187; PHP</title>
	<atom:link href="http://livinginminnesota.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://livinginminnesota.com</link>
	<description>All about life in the Minneapolis St. Paul Area</description>
	<lastBuildDate>Mon, 08 Feb 2010 16:07:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
<cloud domain='livinginminnesota.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>Ping your sitemap</title>
		<link>http://livinginminnesota.com/2007/12/27/ping-your-sitemap/</link>
		<comments>http://livinginminnesota.com/2007/12/27/ping-your-sitemap/#comments</comments>
		<pubDate>Fri, 28 Dec 2007 04:06:23 +0000</pubDate>
		<dc:creator>christrygstad</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://livinginminnesota.com/2007/12/27/ping-your-sitemap/</guid>
		<description><![CDATA[What if you have a sitemap.xml file on your server, and you want to automate the pinging of search engines like google, yahoo, ask and moreover (from what I understand, the sitemaps service for MSN)? If you have a CMS such as Drupal or WordPress, it will automatically ping, or you can ping with PHP [...]]]></description>
			<content:encoded><![CDATA[<p>What if you have a sitemap.xml file on your server, and you want to automate the pinging of search engines like google, yahoo, ask and moreover (from what I understand, the sitemaps service for MSN)? If you have a CMS such as Drupal or WordPress, it will automatically ping, or you can ping with PHP XML-RPC plugins.I couldn&#8217;t find an easy way to simply automate the pinging of my sitemap file with PHP, so I cobbled together my own solution. The only thing you need to do to make this thing work is to replace all the instances of www.mydomain.com with the name of your actual name, and specify the variable &#8216;$sitemapname&#8217; (i.e. sitemap.xml). So, give the following a try and tell me what you think!<span id="more-48"></span><code>echo "&lt;table border=1&gt;&lt;tr&gt;&lt;th&gt;Pings&lt;/th&gt;&lt;/tr&gt;"; //lets setup a table that will show the status of our pingsecho "&lt;tr&gt;&lt;td&gt;";$url_xml = $sitemapname;function pingGoogleSitemaps( $url_xml ){$status = 0;$google = 'www.google.com';if( $fp=@fsockopen($google, 80)){$req =  'GET /webmasters/sitemaps/ping?sitemap=' .urlencode( $url_xml ) . " HTTP/1.1\r\n" ."Host: $google\r\n" ."User-Agent: Mozilla/5.0 (compatible; " .PHP_OS . ") PHP/" . PHP_VERSION . "\r\n" ."Connection: Close\r\n\r\n";fwrite( $fp, $req);while( !feof($fp)){if( @preg_match('~^HTTP/\d\.\d (\d+)~i', fgets($fp, 128), $m)){$status = intval( $m[1] );break;}}fclose( $fp );}return( $status );}if(200 === ($status=pingGoogleSitemaps('http://www.yourdomain.com/sitemap.xml'))){echo "Ping to Google Sitemaps successful.\r\n\r\nStatus code: $status";}else{echo "Cannot ping/connect to Google Sitemaps.\r\n\r\nStatus code: $status";}// end the script.echo "&lt;/td&gt;&lt;/tr&gt;";echo "&lt;tr&gt;&lt;td&gt;";function pingAsk( $url_xml ){$status = 0;$ask = 'submissions.ask.com';if( $fp=@fsockopen($ask, 80) ){$req =  'GET /ping?sitemap=' .urlencode( $url_xml ) . " HTTP/1.1\r\n" ."Host: $ask\r\n" ."User-Agent: Mozilla/5.0 (compatible; " .PHP_OS . ") PHP/" . PHP_VERSION . "\r\n" ."Connection: Close\r\n\r\n";fwrite( $fp, $req );while( !feof($fp) ){if( @preg_match('~^HTTP/\d\.\d (\d+)~i', fgets($fp, 128), $m) ){$status = intval( $m[1] );break;}}fclose( $fp );}return( $status );}if( 200 === ($status=pingAsk('http://www.yourdomain.com/sitemap.xml')) ){echo "Ping to Ask Sitemaps successful.\r\n\r\nStatus code: $status";}else{echo "Cannot ping/connect to Ask.\r\n\r\nStatus code: $status";}// end the script.echo "&lt;/td&gt;&lt;/tr&gt;";echo "&lt;tr&gt;&lt;td&gt;";function pingYahoo( $url_xml ){$status = 0;$yahoo = 'search.yahooapis.com';if( $fp=@fsockopen($yahoo, 80) ){$req =  'GET /SiteExplorerService/V1/ping?sitemap=' .urlencode( $url_xml ) . " HTTP/1.1\r\n" ."Host: $yahoo\r\n" ."User-Agent: Mozilla/5.0 (compatible; " .PHP_OS . ") PHP/" . PHP_VERSION . "\r\n" ."Connection: Close\r\n\r\n";fwrite( $fp, $req );while( !feof($fp) ){if( @preg_match('~^HTTP/\d\.\d (\d+)~i', fgets($fp, 128), $m) ){$status = intval( $m[1] );break;}}fclose( $fp );}return( $status );}if( 200 === ($status=pingYahoo('http://www.yourdomain.com/sitemap.xml')) ){echo "Ping to Yahoo Sitemaps successful.\r\n\r\nStatus code: $status";}else{echo "Cannot ping/connect to Yahoo.\r\n\r\nStatus code: $status";}// end the script.echo "&lt;/td&gt;&lt;/tr&gt;";echo "&lt;tr&gt;&lt;td&gt;";function pingMoreover( $url_xml ){$status = 0;$moreover = 'api.moreover.com';if( $fp=@fsockopen($moreover, 80) ){$req =  'GET /ping?u=' .urlencode( $url_xml ) . " HTTP/1.1\r\n" ."Host: $moreover\r\n" ."User-Agent: Mozilla/5.0 (compatible; " .PHP_OS . ") PHP/" . PHP_VERSION . "\r\n" ."Connection: Close\r\n\r\n";fwrite( $fp, $req );while( !feof($fp) ){if( @preg_match('~^HTTP/\d\.\d (\d+)~i', fgets($fp, 128), $m) ){$status = intval( $m[1] );break;}}fclose( $fp );}return( $status );}if( 200 === ($status=pingMoreover('http://www.yourdomain.com/sitemap.xml')) ){echo "Ping to Moreover Sitemaps successful.\r\n\r\nStatus code: $status";}else{echo "Cannot ping/connect to Moreover.\r\n\r\nStatus code: $status";}// end the script.echo "&lt;/td&gt;&lt;/tr&gt;";echo "&lt;/table&gt;";?&gt;</code></p>
]]></content:encoded>
			<wfw:commentRss>http://livinginminnesota.com/2007/12/27/ping-your-sitemap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dynamically resizing SWFObject to fit into a liquid or flexible layout</title>
		<link>http://livinginminnesota.com/2007/07/25/dynamically-resizing-swfobject-to-fit-into-a-liquid-or-flexible-layout/</link>
		<comments>http://livinginminnesota.com/2007/07/25/dynamically-resizing-swfobject-to-fit-into-a-liquid-or-flexible-layout/#comments</comments>
		<pubDate>Thu, 26 Jul 2007 00:48:31 +0000</pubDate>
		<dc:creator>christrygstad</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.livinginminnesota.com/2007/07/25/dynamically-resizing-swfobject-to-fit-into-a-liquid-or-flexible-layout/</guid>
		<description><![CDATA[I have a website with a flexible layout, I guess you would call it jello, so it resizes depending on the size of the window and resolution, making it difficult to determine what to pass as width and height variables. I wanted it to fit well into its containing &#60;div&#62;. I couldn&#8217;t believe that there [...]]]></description>
			<content:encoded><![CDATA[<p> I have a website with a flexible layout, I guess you would call it jello, so it resizes depending on the size of the window and resolution, making it difficult to determine what to pass as width and height variables. I wanted it to fit well into its containing &lt;div&gt;.</p>
<p>I couldn&#8217;t believe that there wasn&#8217;t already a solution for this, so I made my own. This solution uses a bit of php, javascript, and of course, flash. Please keep in mind that I cannot guarantee the reliability and/or quality of this solution, all I know is that it works for me, with IIS and PHP 5 (also works with PHP 4).<span id="more-46"></span></p>
<p>I tried to make this flexible, so the code that I inserted in the page that contains the page is:<br />
<code>&lt;div id="container"&gt;&lt;?php $flash_file = "flash_file.swf"; include("insert_flash.php");?&gt;&lt;/div&gt;</code><br />
And then I made an file called &#8216;insert_flash.php&#8217;. The code I put in was:<br />
<code> &lt;div id="flashcontent"&gt;<br />
&lt;p&gt;My alternate text in case the reader doesn't have flash.&lt;/p&gt;<br />
&lt;/div&gt;<br />
&lt;script type="text/javascript"&gt;<br />
if ("&lt;?php echo $flash_file;?&gt;" != ""){<br />
dwidth = document.getElementById('container').offsetWidth;<br />
var width = &lt;?php $headerDims = getimagesize($flash_file);$headerWidth =  $headerDims[0];echo $headerWidth;?&gt;;<br />
var height = &lt;?php echo $headerHeight = $headerDims[1];$headerHeight;?&gt;;<br />
if (width &gt; height) {<br />
var percentage = (dwidth / width);<br />
}<br />
else {<br />
var percentage = (dwidth / height);<br />
}<br />
}<br />
var width = Math.floor(width * percentage)-2;<br />
var height = Math.floor(height * percentage)-2;<br />
var so = new SWFObject("&lt;?php echo $flash_file;?&gt;", "mymovie",width,height, "6", "#ffffff");<br />
so.addParam("wmode", "opaque");<br />
so.write("flashcontent");<br />
window.onresize = function(){ //this is if the window gets resized by the user, so you don't have to reload the page on every reload<br />
dwidth = document.getElementById('container').offsetWidth;<br />
var width = &lt;?php $headerDims = getimagesize($flash_file);$headerWidth =  $headerDims[0];echo $headerWidth;?&gt;;<br />
var height = &lt;?php echo $headerHeight = $headerDims[1];$headerHeight;?&gt;;<br />
if (width &gt; height) {<br />
var percentage = (dwidth / width);<br />
}<br />
else {<br />
var percentage = (dwidth / height);<br />
}<br />
var width = Math.floor(width * percentage)-2;<br />
var height = Math.floor(height * percentage)-2;<br />
var so = new SWFObject("&lt;?php echo $flash_file;?&gt;", "mymovie",width,height, "6", "#ffffff");<br />
so.addParam("wmode", "opaque");<br />
so.write("flashcontent");<br />
}<br />
&lt;/script&gt;</code><br />
Try it out and play with it, the only thing I really experimented with was the &#8216;-2&#8242; when setting the width and height variables.  I&#8217;m sure this could be adjusted by setting the properties of the container and flashcontent divs.</p>
<p>Any improvements to suggest? I did try to put the &#8216;window.onresize&#8217; function into a separate function, so I wouldn&#8217;t have to reuse code, but it didn&#8217;t work, for some reason.</p>
]]></content:encoded>
			<wfw:commentRss>http://livinginminnesota.com/2007/07/25/dynamically-resizing-swfobject-to-fit-into-a-liquid-or-flexible-layout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
