<?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>remote server &#8211; stoimen&#039;s web log</title>
	<atom:link href="/tag/remote-server/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>on web development</description>
	<lastBuildDate>Tue, 13 Feb 2018 08:18:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>Read Remote File Content-Type with Zend_Http_Client</title>
		<link>/2010/03/23/read-remote-file-content-type-with-zend_http_client/</link>
		<comments>/2010/03/23/read-remote-file-content-type-with-zend_http_client/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 06:00:16 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[Computer networking]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[HEAD]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[Hypertext Transfer Protocol]]></category>
		<category><![CDATA[Internet protocols]]></category>
		<category><![CDATA[PHP programming language]]></category>
		<category><![CDATA[remote server]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[World Wide Web]]></category>
		<category><![CDATA[Zend Technologies]]></category>

		<guid isPermaLink="false">/?p=1375</guid>
		<description><![CDATA[Check an Image on a Remote Server This is a common task. You&#8217;d like to know whether the image on the remote server exists. Zend Framework gives the answer of this question and in particular this can be completed with Zend_Http_Client. Content-Type and Content-Length The little problem is that checking for content-type is not always &#8230; <a href="/2010/03/23/read-remote-file-content-type-with-zend_http_client/" class="more-link">Continue reading <span class="screen-reader-text">Read Remote File Content-Type with Zend_Http_Client</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2011/04/07/use-fopen-to-check-file-availability/" rel="bookmark" title="Use fopen() to Check File Availability?">Use fopen() to Check File Availability? </a></li>
<li><a href="/2010/04/14/zend_http_client-and-case-sensitivity/" rel="bookmark" title="Zend_Http_Client and Case Sensitivity">Zend_Http_Client and Case Sensitivity </a></li>
<li><a href="/2011/04/13/post-with-zend_http_client/" rel="bookmark" title="POST with Zend_Http_Client">POST with Zend_Http_Client </a></li>
<li><a href="/2010/06/28/send-authenticated-post-request-with-zend_http_client/" rel="bookmark" title="Send Authenticated POST Request with Zend_Http_Client">Send Authenticated POST Request with Zend_Http_Client </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Check an Image on a Remote Server</h2>
<p>This is a common task. You&#8217;d like to know whether the image on the remote server exists. <a title="Zend Framework" href="http://framework.zend.com/" target="_blank">Zend Framework</a> gives the answer of this question and in particular this can be completed with <a href="http://framework.zend.com/manual/en/zend.http.html" target="_blank">Zend_Http_Client</a>.</p>
<h2>Content-Type and Content-Length</h2>
<p>The little problem is that checking for content-type is not always correct, because it will return an image content type even when the image does not exists, so it&#8217;s better to check for content-length.</p>
<h2>Code</h2>
<p>The simple way to check this is like that:</p>
<pre lang="php" escaped="true">$client = new Zend_Http_Client('http://remote-machine/image.jpg');
$response = $client-&gt;request('head');
if ( NULL == $response-&gt;getHeader('Content-Length') )
    // do whatever if the image does not exists.</pre>
<p>In fact here, in this example I don&#8217;t check for GET request, because is way to slow than the HEAD method, but you should be aware of incorrect responses when using HEAD. In fact if you request the HEAD of a FLV video it will be returned text content-type, while using GET everything&#8217;s working fine but slow though.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2011/04/07/use-fopen-to-check-file-availability/" rel="bookmark" title="Use fopen() to Check File Availability?">Use fopen() to Check File Availability? </a></li>
<li><a href="/2010/04/14/zend_http_client-and-case-sensitivity/" rel="bookmark" title="Zend_Http_Client and Case Sensitivity">Zend_Http_Client and Case Sensitivity </a></li>
<li><a href="/2011/04/13/post-with-zend_http_client/" rel="bookmark" title="POST with Zend_Http_Client">POST with Zend_Http_Client </a></li>
<li><a href="/2010/06/28/send-authenticated-post-request-with-zend_http_client/" rel="bookmark" title="Send Authenticated POST Request with Zend_Http_Client">Send Authenticated POST Request with Zend_Http_Client </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/03/23/read-remote-file-content-type-with-zend_http_client/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
