curl-and-php
Re: Re: Retrieving XML file through an HTTP url requiring athentication
Date: Fri, 2 Jan 2004 17:04:21 +0100
Well, actually, I didn't put in the thread the different declared
variables.
Also, using Ethereal, I have noticed that cURL is apparently using the
'get' request method to send the variables.
I learnt also that cURL, even though the last versions support Digest, it
is not working yet with PHP4, but will with PHP5. Is that true? And so, I
think that's the reason of my problems.
In that case, what can I do in order to authenticate my request using
cURL, knowing that I cannot, for now, update the server to PHP5, and I
cannot use command line execution (for security reason)?
The result in the XML file is the 401 page 'Access Denied' answer. Is
there no way to use cURL when the authentication method used is Digest?
Or maybe I am totally out of the subject, since I am just discovering cURL
and I am not an HTTP expert. If someone can help!
Here is a similar copy of my code:
---- //The resulting xml file should be stored here: $outputfile = "main2.xml"; //The outputstream $fp = fopen($outputfile, "w"); echo "Initializing cURL session...<br>"; $url = "http://results.blabla.com/blabla_aspx/feedblabla/main.aspx"; $ch = curl_init(); $passw = "PassW"; $userpassw = "UserName:".$passw; $urlc = $userpassw.$url; curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERPWD, $urlc); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FILE, $fp); echo "Executing cURL options...<br>"; curl_exec($ch); curl_close($ch); fclose($fp); ... ---- Thanx a lot! Christian ------------------------------------------------------- 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=clickReceived on 2004-01-03