Thread: cURL
View Single Post
Old 10-22-2007, 08:59 AM   #2 (permalink)
sketchMedia
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

This is how to use cURL to grab a file
PHP Code:
/*First we Initialize a new cURL session and pass in our url,
then it returns a cURL handle */
$ch curl_init("http://www.blahblah.com/file.txt");

/*We must set CURLOPT_RETURNTRANSFER to true otherwise it just farts
 it out to screen instead of putting it into $file when we run curl_exec()*/
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);

//Execute and put contains in $file
$file curl_exec($ch);

//close the cURL session
curl_close($ch); 
Hope that helps
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)

Last edited by sketchMedia : 10-22-2007 at 09:27 AM. Reason: spelling error
sketchMedia is offline  
Reply With Quote