Results 1 to 4 of 4

Thread: cURL to pass htaccess authentication? [RESOLVED]

  1. #1

    Thread Starter
    Addicted Member Phenix's Avatar
    Join Date
    Sep 2002
    Location
    Near A Cube
    Posts
    228

    Question cURL to pass htaccess authentication? [RESOLVED]

    Do you know how to use CURL, Client URL Library Functions to get a page that is protected with htaccess if you know the username and password for the realm?

    I tried this
    Code:
    $ch = curl_init();
    curl_setopt ($ch, CURLOPT_URL, $url);
    curl_setopt ($ch, CURLOPT_USERPWD, "[username]:[password]");
    //curl_setopt ($ch, CURLOPT_HEADER, 0); with and without this line
    curl_exec ($ch);
    curl_close ($ch);
    but it says I didn't authenticate.

    I've used it in the past to get an unprotected url and even to pass info via post.

    Or is there a way to pass it in the url like we would for ftp?
    Code:
    ftp(http)://username:password@insert.ip.address.here/thePath/theFile.php
    Last edited by Phenix; May 20th, 2003 at 10:18 AM.

  2. #2
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,326
    passing it in the url should work. other than that I have not used curl to pass info like that

  3. #3

    Thread Starter
    Addicted Member Phenix's Avatar
    Join Date
    Sep 2002
    Location
    Near A Cube
    Posts
    228
    I'll have to test it tomorrow at work.

  4. #4

    Thread Starter
    Addicted Member Phenix's Avatar
    Join Date
    Sep 2002
    Location
    Near A Cube
    Posts
    228

    Thumbs up Saahhweeet

    as the url, works directly without having to add any additional CURLOPT_'s.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width