Results 1 to 4 of 4

Thread: cURL to pass htaccess authentication? [RESOLVED]

Threaded View

  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:[email protected]/thePath/theFile.php
    Last edited by Phenix; May 20th, 2003 at 10:18 AM.

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