umbrellaman All American 10892 Posts user info edit post |
I'm trying to download jpegs from a website, and am using a php script to do it. I supply the urls correctly, but I keep on getting a "no url set!" error. I can see the images appear in the correct directories, but when I inspect them they contain no data and cannot be displayed. No matter what I do, the script keeps insisting that I haven't set any urls, even if I feed them in directly as raw strings. What am I doing wrong? Here is the essential code:
$fp = fopen($file_path,"w") or die("fuck!\n"); $ch = curl_init() or die("fuck again!\n"); curl_setopt($ch, curlopt_URL, $url); curl_setopt($ch, curlopt_FILE, $fp); curl_exec($ch); curl_close($ch); fclose($fp);
One more thing. If I don't set curlopt_URL and instead put the url inside of curl_init(), I get a bunch of gibberish appear in my terminal. This does not happen when the code is run as shown. What does that mean? 8/6/2009 11:08:02 PM |