[thelist] cURL, PHP and downloading files

Jay Blanchard jay.blanchard at niicommunications.com
Tue Jul 2 09:09:01 CDT 2002


Good morning gurus!

I need to download files from an https connection so I have chosen cURL
(http://curl.haxx.se/) to do this. I can do one-off downloads, but I need to
be able to place this information in a PHP script. cURL is run from the
command line so I am using the exec() function thusly;

exec("curl -d \"name=myname&password=mypassword&btnsubmit=submit\" -s -o
cdrlist.html https://theserver.com/list.html");

but why can't I do this

exec("curl -d \"name=myname&password=mypassword&btnsubmit=submit\" -s -o
".$listline." https://theserver.com/download/".$listline."");

Then I put everything in variables, thinking that maybe the exec() function
didn't like concatenation so...

$curlinfo_1 = "\"name=myname&password=mypassword&btnsubmit=submit\"";
$curlinfo_2 = $listline
$curlinfo_3 = "https://theserver.com/download/".$listline";

exec("curl -d $curlinfo_1 -s -o $curlinfo_2 curlinfo_3");

I can insert a print statement and the line looks OK, the syntax is correct.
Has any of you used cURL, or can any of you see if I am leaving something
out? If not I am going to have major troubles setting up an automated
download from the https connection. I probably could do it in PERL, but
would rather not if I don't have to.

Much TIA!

Jay





More information about the thelist mailing list