<?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: Check Site Loading Speed using CURL curl_getinfo() in PHP.</title>
	<atom:link href="http://www.inetminds.com/check-site-loading-speed-using-curl-functions-259/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.inetminds.com/check-site-loading-speed-using-curl-functions-259/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
	<description>Inteminds, PHP scripts, php tutors, Java and ajax scripts explained</description>
	<lastBuildDate>Fri, 01 Apr 2011 08:24:21 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
	<item>
		<title>By: Klaitos</title>
		<link>http://www.inetminds.com/check-site-loading-speed-using-curl-functions-259/comment-page-1/#comment-1403</link>
		<dc:creator>Klaitos</dc:creator>
		<pubDate>Wed, 16 Feb 2011 09:18:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.inetminds.com/?p=259#comment-1403</guid>
		<description>Hi, nice script but can i know the intire download time ? (with images and css)</description>
		<content:encoded><![CDATA[<p>Hi, nice script but can i know the intire download time ? (with images and css)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PHP_Starter</title>
		<link>http://www.inetminds.com/check-site-loading-speed-using-curl-functions-259/comment-page-1/#comment-1387</link>
		<dc:creator>PHP_Starter</dc:creator>
		<pubDate>Fri, 15 Jan 2010 09:13:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.inetminds.com/?p=259#comment-1387</guid>
		<description>Because the total time depends on the number of connections to the server at a time of running this script(also many other factors  effects this).</description>
		<content:encoded><![CDATA[<p>Because the total time depends on the number of connections to the server at a time of running this script(also many other factors  effects this).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tahsin hasan</title>
		<link>http://www.inetminds.com/check-site-loading-speed-using-curl-functions-259/comment-page-1/#comment-1385</link>
		<dc:creator>tahsin hasan</dc:creator>
		<pubDate>Thu, 12 Nov 2009 05:53:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.inetminds.com/?p=259#comment-1385</guid>
		<description>Hi,

Plz see my problem.

*** code starts here


function byte_convert($bytes)
{
$symbol = array(&#039;B&#039;, &#039;KB&#039;, &#039;MB&#039;, &#039;GB&#039;, &#039;TB&#039;, &#039;PB&#039;, &#039;EB&#039;, &#039;ZB&#039;, &#039;YB&#039;);

$exp = 0;
$converted_value = 0;
if( $bytes &gt; 0 )
{
$exp = floor( log($bytes)/log(1024) );
$converted_value = ( $bytes/pow(1024,floor($exp)) );
}

return sprintf( &#039;%.2f &#039;.$symbol[$exp], $converted_value );
}

$userAgent = &#039;Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)&#039;;
$url = &#039;http://ksino.com/&#039;;

// initialize curl with given url
$ch = curl_init($url);
// make sure we get the header
curl_setopt($ch, CURLOPT_HEADER, 1);
// make it a http HEAD request
curl_setopt($ch, CURLOPT_NOBODY, 1);
// add useragent
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
//Tell curl to write the response to a variable
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// The maximum number of seconds to allow cURL functions to execute.
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,60);
// Tell curl to stop when it encounters an error
curl_setopt($ch, CURLOPT_FAILONERROR, 1);

$execute = curl_exec($ch);

// Check if any error occured
if(!curl_errno($ch))
{
$bytes = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD);
// Display the File Size
echo byte_convert($bytes);

$total_time = curl_getinfo($ch);

print_r($total_time);
//echo &#039;Took &#039; . $total_time . &#039; seconds to send a request to &#039; . $url;
clearstatcache();
}
curl_close($ch);

**** code ends here

plz run the code, and try to refresh it several time. and u will see the &#039;total_time&#039; value will be changed every time. why?

tahsin.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Plz see my problem.</p>
<p>*** code starts here</p>
<p>function byte_convert($bytes)<br />
{<br />
$symbol = array(&#8216;B&#8217;, &#8216;KB&#8217;, &#8216;MB&#8217;, &#8216;GB&#8217;, &#8216;TB&#8217;, &#8216;PB&#8217;, &#8216;EB&#8217;, &#8216;ZB&#8217;, &#8216;YB&#8217;);</p>
<p>$exp = 0;<br />
$converted_value = 0;<br />
if( $bytes &gt; 0 )<br />
{<br />
$exp = floor( log($bytes)/log(1024) );<br />
$converted_value = ( $bytes/pow(1024,floor($exp)) );<br />
}</p>
<p>return sprintf( &#8216;%.2f &#8216;.$symbol[$exp], $converted_value );<br />
}</p>
<p>$userAgent = &#8216;Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)&#8217;;<br />
$url = &#8216;<a href="http://ksino.com/&#039;" rel="nofollow">http://ksino.com/&#039;</a>;</p>
<p>// initialize curl with given url<br />
$ch = curl_init($url);<br />
// make sure we get the header<br />
curl_setopt($ch, CURLOPT_HEADER, 1);<br />
// make it a http HEAD request<br />
curl_setopt($ch, CURLOPT_NOBODY, 1);<br />
// add useragent<br />
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);<br />
//Tell curl to write the response to a variable<br />
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);<br />
// The maximum number of seconds to allow cURL functions to execute.<br />
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,60);<br />
// Tell curl to stop when it encounters an error<br />
curl_setopt($ch, CURLOPT_FAILONERROR, 1);</p>
<p>$execute = curl_exec($ch);</p>
<p>// Check if any error occured<br />
if(!curl_errno($ch))<br />
{<br />
$bytes = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD);<br />
// Display the File Size<br />
echo byte_convert($bytes);</p>
<p>$total_time = curl_getinfo($ch);</p>
<p>print_r($total_time);<br />
//echo &#8216;Took &#8216; . $total_time . &#8216; seconds to send a request to &#8216; . $url;<br />
clearstatcache();<br />
}<br />
curl_close($ch);</p>
<p>**** code ends here</p>
<p>plz run the code, and try to refresh it several time. and u will see the &#8216;total_time&#8217; value will be changed every time. why?</p>
<p>tahsin.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

