Lyrics - Kamala - Wordpress Theme - Myspace Layouts - Cheap Plane Tickets

PDA

View Full Version : php curl, download size limit


phpmania
Apr 26th 2009, 6:14 am
Hi all
How I can get the page by php curl only first 10 character or only first 10 kb of page I don’t what download all of page.
Dose any one have idea
Thanks

tguillea
Apr 26th 2009, 3:47 pm
Not sure if this will work but if you can access remote files you could use the following


$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "remote_filename.txt");
//you might need to uncomment below?
//curl_setopt($ch, CURLOPT_FILE, fopen("destination/to_save/filename.txt"));

//execute the curl by opening the file
$handle = fopen(curl_exec($ch),"w+");
//save the file
$file_string = fread($handle,10);
// CLOSE CURL
curl_close ($ch);
fclose($handle);


I just kind of threw this together and have no idea if it will work. It will definitely need some modification to work.

Good luck!