Hello list,

I am writing a php script to fetch a html page and verify its content which 
generated by a remote cgi program. The special cgi program generates endless 
content to the http client. Therefore, I need to figure out a solution for 
curl to fetch part of the html source code(In fact, I only need the first 100 
lines of the html source). I tried CURLOPT_TIMEOUT, but when curl_exec() 
timeouts, it will not return part of the html source it already 
fetched--actually it returns nothing at all.

Is there any way to work around this?


#!/usr/bin/php4 -q
<?php

$url = "http://www.example.com/cgi-bin/large_output.cgi";;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
$result = curl_exec($ch);
curl_close($ch);
echo $result;
?>
-- 
Patrick Hsieh<[EMAIL PROTECTED]>
GnuPG Pubilc Key at http://www.ezplay.tv/~pahud/pahudatezplay.pubkey
MD5 checksum: b948362c94655b74b33e859d58b8de91

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to