cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: Retrieving XML file through an HTTP url requiring athentication

From: Diana Castillo <diana_at_hotelkey.com>
Date: Fri, 2 Jan 2004 13:24:34 +0100

I believe CURL uses post
  ----- Original Message -----
  From: Christian_Dudek/URIEL.MC_at_URIEL.MC
  To: curl-and-php_at_lists.sourceforge.net
  Sent: Friday, January 02, 2004 10:24 AM
  Subject: Retrieving XML file through an HTTP url requiring athentication

        Hello everybody and Happy New Year 2004!
          
        I have a question for you all:
          
        I need to retrieve an XML file from an ASP server, so that I can use it with PHP and XSLT to use the informations the way I want.
        The XML file is generated through an ASPX page under http and it need a password to be accessible.
        My problem is that if I use the address directly into my borwser like:
        http : // username:passw@ www .thesite.com /ghj/trioze.aspx , my browser displays correctly the page.
        Now, using cURL with this code:

          echo "Initializing cURL session...<br>";
          $ch = curl_init("http : // www .thesite.com /ghj/trioze.aspx ");
          echo "Setting cURL options...<br>";
          //curl_setopt($ch, CURLOPT_URL, "http : // www .thesite.com /ghj/trioze.aspx ");
          curl_setopt($ch, CURLOPT_USERPWD, "username:passw");
          curl_setopt($ch, CURLOPT_FILE, $fp);
          curl_setopt($ch, CURLOPT_HEADER, 1);
          echo "Executing cURL options...<br>";
          curl_exec($ch);
          curl_close($ch);
          fclose($fp);
          
        I get a 401 Acces Denied error. I know the aspx request is made through the 'get' method. I know also that cURL is using the same method. Why does it not work? Is there any additionnal informations I need to send with the curl_setopt()? Maybe it is too obvious and I am not getting it.
        If anybody can help, that would be fantastic!
          
        Many thanks anyway!
          
        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=click
Received on 2004-01-02