Ok, I'm fairly familiar with php, etc, but I am for the first time trying to get it to download a file for me. Using the example found in the php manual on
http://www.php.net, this is what I'm using:
[php]<?php
$ch = curl_init ("http://www.apple.com/");
$fp = fopen ("apple_homepage.txt", "w");
curl_setopt ($ch, CURLOPT_FILE, $fp);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_exec ($ch);
curl_close ($ch);
fclose ($fp);
?>[/php]
Unfortunately, everytime I run this, I don't get a file called apple_homepage.txt as expected, but rather the apple.com homepage outputted to the browser. Can anyone tell me why I'm not getting the expected result?
I even tried just running the following without success (no file created):
[php]<?php
$a = `curl http://www.apple.com -o apple_homepage.txt`;
echo 'something should have happened';
?>[/php]
Unfortunately, nothing happened here either. Why?
[edit] auto-parse urls messed with the second php code block