<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: How To HTTP-PUT A File Somewhere Using PHP</title>
	<atom:link href="http://www.littlehart.net/atthekeyboard/2008/01/11/how-to-http-put-a-file-somewhere-using-php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.littlehart.net/atthekeyboard/2008/01/11/how-to-http-put-a-file-somewhere-using-php/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=rss</link>
	<description>Facebook should&#039;ve be written in unicornSchemaLang, because everyone *knows* that PHP is no good for anything, right?</description>
	<lastBuildDate>Sun, 14 Mar 2010 00:58:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<atom:link rel="hub" href="http://pubsubhubbub.appspot.com" />
		<item>
		<title>By: Matt Lyons</title>
		<link>http://www.littlehart.net/atthekeyboard/2008/01/11/how-to-http-put-a-file-somewhere-using-php/comment-page-1/#comment-8809</link>
		<dc:creator>Matt Lyons</dc:creator>
		<pubDate>Wed, 19 Mar 2008 14:48:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.littlehart.net/atthekeyboard/2008/01/11/how-to-http-put-a-file-somewhere-using-php/#comment-8809</guid>
		<description>Try as I might I couldn&#039;t get Chris&#039;s code to work in my situation. For others who might find the same issues here is a fsockopen example that worked for me.

function realSocket() {
   $fp = fsockopen(&quot;www.example.com&quot;, 80, $errno, $errstr, 12);

	fwrite($fp, &quot;PUT /somewhere/somefile HTTP/1.1\r\n&quot;);
    fwrite($fp, &quot;Host: www.example.com\r\n&quot;);
    fwrite($fp, &quot;Content-Length: 8\r\n\r\n&quot;);
    fwrite($fp, &quot;testdata\r\n\r\n&quot;);

	echo &quot;&quot;;
    while (!feof($fp)) {
        echo fgets($fp, 128);
    }
	echo &quot;&quot;;

    fclose($fp);
}

realSocket();</description>
		<content:encoded><![CDATA[<p>Try as I might I couldn&#8217;t get Chris&#8217;s code to work in my situation. For others who might find the same issues here is a fsockopen example that worked for me.</p>
<p>function realSocket() {<br />
   $fp = fsockopen(&#8220;www.example.com&#8221;, 80, $errno, $errstr, 12);</p>
<p>	fwrite($fp, &#8220;PUT /somewhere/somefile HTTP/1.1\r\n&#8221;);<br />
    fwrite($fp, &#8220;Host: <a href="http://www.example.com" rel="nofollow">http://www.example.com</a>\r\n&#8221;);<br />
    fwrite($fp, &#8220;Content-Length: 8\r\n\r\n&#8221;);<br />
    fwrite($fp, &#8220;testdata\r\n\r\n&#8221;);</p>
<p>	echo &#8220;&#8221;;<br />
    while (!feof($fp)) {<br />
        echo fgets($fp, 128);<br />
    }<br />
	echo &#8220;&#8221;;</p>
<p>    fclose($fp);<br />
}</p>
<p>realSocket();</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Hartjes</title>
		<link>http://www.littlehart.net/atthekeyboard/2008/01/11/how-to-http-put-a-file-somewhere-using-php/comment-page-1/#comment-8480</link>
		<dc:creator>Chris Hartjes</dc:creator>
		<pubDate>Wed, 16 Jan 2008 20:14:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.littlehart.net/atthekeyboard/2008/01/11/how-to-http-put-a-file-somewhere-using-php/#comment-8480</guid>
		<description>@Brandon
You may be right, but I think end(...) seems a little more intuitive that using the -1 array index.  They both work, and I have used that trick (the -1 array index) in other cases.</description>
		<content:encoded><![CDATA[<p>@Brandon<br />
You may be right, but I think end(&#8230;) seems a little more intuitive that using the -1 array index.  They both work, and I have used that trick (the -1 array index) in other cases.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brendon Kozlowski</title>
		<link>http://www.littlehart.net/atthekeyboard/2008/01/11/how-to-http-put-a-file-somewhere-using-php/comment-page-1/#comment-8479</link>
		<dc:creator>Brendon Kozlowski</dc:creator>
		<pubDate>Wed, 16 Jan 2008 19:50:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.littlehart.net/atthekeyboard/2008/01/11/how-to-http-put-a-file-somewhere-using-php/#comment-8479</guid>
		<description>Chris, although that&#039;s a very handy dandy use of end(), but I wonder, wouldn&#039;t it have more overhead than using an array index of -1?

$code = $matches[1][-1];

I suppose it might depend on the underlying code for array indexing and end() itself, I&#039;ve just always used the array indexing.  :)</description>
		<content:encoded><![CDATA[<p>Chris, although that&#8217;s a very handy dandy use of end(), but I wonder, wouldn&#8217;t it have more overhead than using an array index of -1?</p>
<p>$code = $matches[1][-1];</p>
<p>I suppose it might depend on the underlying code for array indexing and end() itself, I&#8217;ve just always used the array indexing.  <img src='http://www.littlehart.net/atthekeyboard/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Hartjes</title>
		<link>http://www.littlehart.net/atthekeyboard/2008/01/11/how-to-http-put-a-file-somewhere-using-php/comment-page-1/#comment-8477</link>
		<dc:creator>Chris Hartjes</dc:creator>
		<pubDate>Wed, 16 Jan 2008 15:49:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.littlehart.net/atthekeyboard/2008/01/11/how-to-http-put-a-file-somewhere-using-php/#comment-8477</guid>
		<description>@Chad
Well, cURL seems to require more lines of code to do the same thing, so fewer lines of code is always a good thing in my book.  Just a personal preference, nothing more.

As for extensions, again, it&#039;s just personal preference.  One lest thing to worry about when compiling and installing PHP (I tend to do it from scratch when it&#039;s my own stuff).  There are some really good extensions out there, so don&#039;t shy away from using one that fits.</description>
		<content:encoded><![CDATA[<p>@Chad<br />
Well, cURL seems to require more lines of code to do the same thing, so fewer lines of code is always a good thing in my book.  Just a personal preference, nothing more.</p>
<p>As for extensions, again, it&#8217;s just personal preference.  One lest thing to worry about when compiling and installing PHP (I tend to do it from scratch when it&#8217;s my own stuff).  There are some really good extensions out there, so don&#8217;t shy away from using one that fits.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chad</title>
		<link>http://www.littlehart.net/atthekeyboard/2008/01/11/how-to-http-put-a-file-somewhere-using-php/comment-page-1/#comment-8475</link>
		<dc:creator>Chad</dc:creator>
		<pubDate>Wed, 16 Jan 2008 04:39:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.littlehart.net/atthekeyboard/2008/01/11/how-to-http-put-a-file-somewhere-using-php/#comment-8475</guid>
		<description>Your comment

&quot;I&#039;m also quite proud that it&#039;s cURL free, as cURL seems to be the first option that most people use when doing this kind of thing.&quot;

caught my attention.  Is there any particular reason for not wanting to use cURL?  I saw in another comment that you like to avoid extensions.  Any reason for that?

I am fairly new to programming, so I am interested in people&#039;s practices and preferences.

Thanks</description>
		<content:encoded><![CDATA[<p>Your comment</p>
<p>&#8220;I&#8217;m also quite proud that it&#8217;s cURL free, as cURL seems to be the first option that most people use when doing this kind of thing.&#8221;</p>
<p>caught my attention.  Is there any particular reason for not wanting to use cURL?  I saw in another comment that you like to avoid extensions.  Any reason for that?</p>
<p>I am fairly new to programming, so I am interested in people&#8217;s practices and preferences.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Henryb</title>
		<link>http://www.littlehart.net/atthekeyboard/2008/01/11/how-to-http-put-a-file-somewhere-using-php/comment-page-1/#comment-8469</link>
		<dc:creator>Henryb</dc:creator>
		<pubDate>Tue, 15 Jan 2008 13:09:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.littlehart.net/atthekeyboard/2008/01/11/how-to-http-put-a-file-somewhere-using-php/#comment-8469</guid>
		<description>A bit offtopic.. But what happend to all the colors and the easy readable design :(</description>
		<content:encoded><![CDATA[<p>A bit offtopic.. But what happend to all the colors and the easy readable design <img src='http://www.littlehart.net/atthekeyboard/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PHPDeveloper.org</title>
		<link>http://www.littlehart.net/atthekeyboard/2008/01/11/how-to-http-put-a-file-somewhere-using-php/comment-page-1/#comment-8467</link>
		<dc:creator>PHPDeveloper.org</dc:creator>
		<pubDate>Mon, 14 Jan 2008 14:00:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.littlehart.net/atthekeyboard/2008/01/11/how-to-http-put-a-file-somewhere-using-php/#comment-8467</guid>
		<description>&lt;strong&gt;Chris Hartjes&#039; Blog: How To HTTP-PUT A File Somewhere Using PHP...&lt;/strong&gt;


Chris Hartjes has a quick post (but complete with code) about ......</description>
		<content:encoded><![CDATA[<p><strong>Chris Hartjes&#8217; Blog: How To HTTP-PUT A File Somewhere Using PHP&#8230;</strong></p>
<p>Chris Hartjes has a quick post (but complete with code) about &#8230;&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Hartjes</title>
		<link>http://www.littlehart.net/atthekeyboard/2008/01/11/how-to-http-put-a-file-somewhere-using-php/comment-page-1/#comment-8460</link>
		<dc:creator>Chris Hartjes</dc:creator>
		<pubDate>Sat, 12 Jan 2008 00:46:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.littlehart.net/atthekeyboard/2008/01/11/how-to-http-put-a-file-somewhere-using-php/#comment-8460</guid>
		<description>@Simon
But that would require an external package (PEAR in this case) and I really try to avoid adding external libraries to an application if I can.</description>
		<content:encoded><![CDATA[<p>@Simon<br />
But that would require an external package (PEAR in this case) and I really try to avoid adding external libraries to an application if I can.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon Brüchner</title>
		<link>http://www.littlehart.net/atthekeyboard/2008/01/11/how-to-http-put-a-file-somewhere-using-php/comment-page-1/#comment-8459</link>
		<dc:creator>Simon Brüchner</dc:creator>
		<pubDate>Fri, 11 Jan 2008 23:19:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.littlehart.net/atthekeyboard/2008/01/11/how-to-http-put-a-file-somewhere-using-php/#comment-8459</guid>
		<description>To get the HTTP status you could also use PEAR::HTTP_Request

require_once &quot;HTTP/Request.php&quot;;
$req =&amp; new HTTP_Request(&quot;&quot;);
$req-&gt;setURL(&#039;http://www.example.com/&#039;);
$req-&gt;sendRequest();
$code = $req-&gt;getResponseCode();

This class supports PUT an DELETE too, but I&#039;ve never used it that way.</description>
		<content:encoded><![CDATA[<p>To get the HTTP status you could also use PEAR::HTTP_Request</p>
<p>require_once &#8220;HTTP/Request.php&#8221;;<br />
$req =&amp; new HTTP_Request(&#8220;&#8221;);<br />
$req-&gt;setURL(&#8216;http://www.example.com/&#8217;);<br />
$req-&gt;sendRequest();<br />
$code = $req-&gt;getResponseCode();</p>
<p>This class supports PUT an DELETE too, but I&#8217;ve never used it that way.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->