Results 1 to 2 of 2
  1. #1

    Curl (PHP)login to https

    Hi,
    Please excuse if similar issue has been posted earlier.
    My scenario is
    Login to a https site .
    Once I login,I find a link to download a file.
    Now all this I want to do with the help of curl.
    I want the script in PHP for
    1) login to https site
    2)download the file?After applying the regex,I can get the link of the file easily but problem comes for downloading the file?Do I have to use JavaScript for that or use location header to redirect to file download link?
    Thanks in advance

  2. #2
    Join Date
    Apr 2007
    Location
    Calgary, Canada
    Posts
    200
    Well, using curl to login is pretty easy, just set your options to use SSL, set your post data (your username and login) and execute the request to get the contents.

    Here's something what I would do, but don't bark at me if it doesn't work.
    PHP Code:
    $c curl_init($loginurl);

    // Use SSL
    curl_setopt($cCURLOPT_SSL_VERIFYPEERFALSE);
    curl_setopt($cCURLOPT_SSL_VERIFYHOST2);

    curl_setopt($cCURLOPT_POSTFIELDS$loginDetails);
    curl_setopt($cCURLOPT_RETURNTRANSFERTRUE);

    $html curl_exec($c);
    curl_close($c); 
    Downloading a file is also pretty easy, just set CURLOPT_FILE to the file name, and execute the request to the download the file.

Similar Threads

  1. cPanel webmail login using cURL
    By larwilliams in forum Programming Discussion
    Replies: 3
    Last Post: 06-16-2009, 01:49 AM
  2. cURL with OpenSSL and Secure HTTPS
    By AndreF in forum Programming Discussion
    Replies: 6
    Last Post: 06-19-2008, 08:15 AM
  3. https and forum login
    By ChrisLM2001a in forum Web Hosting Lounge
    Replies: 9
    Last Post: 04-15-2003, 02:02 PM
  4. Https Login Not Working
    By azrazorback in forum Dedicated Server
    Replies: 4
    Last Post: 11-29-2002, 02:09 PM
  5. Need HELP with CURL/PHP secure https post with curl_exec()
    By hoser in forum Hosting Security and Technology
    Replies: 5
    Last Post: 04-11-2002, 03:58 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
  •