In reply to:
Hey Gang, I have a script that uses fopen that I'm converting to cUrl so that it's compatible with dreamhost. The script looks for information on a specific line number
$line=fgets($file,222);
basically all the information on line 222 is returned with the fopen script.
Use cURL to grab everything, and then use further scripting to access the line you want. The following example should work:
<?php
$ch = curl_init();
$timeout = 5; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, 'http://example.com');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$file_contents = curl_exec($ch);
curl_close($ch);
$lines = array();
$lines = explode("\n", $file_contents);
echo $lines[222];
?>
If the line is HTML, you will need to wrap convert the HTML entities to see it displayed:
echo htmlspecialchars($lines[222]);
--------
Simon Jessey | Keystone Websites
Save $97 on yearly plans with promo code SCJESSEY97