curl-and-php
Re: RE: Re: Retrieving XML file through an HTTP url requiring athentication
Date: Tue, 6 Jan 2004 13:57:21 +0100
Ok, well, we have decided to go through the exec command in php. We don't
have much time to deal with the source code, even though, it would be a
good idea during spare times! But I am way well busy during my spare time!
I really appreciate your help, Daniel, Diana and Patrick. Thanks a lot, I
learnt a lot through those threads and many readings about cURL and php.
My conclusion to all this would be: cURL works fine with PHP as long as
there is no other type than Basic authentication or none to access a url.
The command
curl_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
doesn't work with PHP 4.3.3
Maybe it will be supported in PHP 5.
The only way to go around is to use an exec command inside your PHP code.
Here is a snippet of the code I've written:
$curl_path = "c:\\somefolder\\curl\\curl.exe"; //should be a relative path
instead of absolute.
$command = `$curl_path --digest -o"somefile.xyz" -u"usrname:pssw"
"http://www.site.com/xyz/yzx/file.xyz"`; //notice the ` ` to do the exec.
This allows you not to use '\' in the string.
where '--digest' is the argument to set a Digest authentication process
with the server (in relation with the -u argument).
All of this are well documented on this site.
I hope this helped.
Cheers.
Chris
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
Received on 2004-01-06