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
Maybe a dumb question, but aren't the cURL option constants in all caps (e.g. CURLOPT_URL)?
8/6/2009 11:24:12 PM
I didn't think it would matter, but I can try that.
8/6/2009 11:31:28 PM
http://us.php.net/manual/en/language.constants.php
8/6/2009 11:33:07 PM
FroshKiller pwns once again, capitalizing seems to have done the trick.Thanks Frosh.
8/6/2009 11:38:06 PM
That is exactly the kind of thing I would've pulled my hair out over. I feel your pain.
8/6/2009 11:41:55 PM
lolwith any programming language, it's safer to assume that EVERYTHING is case-sensitive.
8/6/2009 11:47:36 PM