Jump to content

Recommended Posts

Hi guys. i want to use curl to authenticate to rapishare. I have set up libcurl.

 

<?php

// FIND BOOKS ON PHP AND MYSQL ON AMAZON

$url = "https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi";

$ch = curl_init();    // initialize curl handle

curl_setopt($ch, CURLOPT_URL,$url); // set url to post to

curl_setopt($ch, CURLOPT_FAILONERROR, 1);

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects

curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable

curl_setopt($ch, CURLOPT_TIMEOUT, 3); // times out after 4s

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,  2);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);  // this line makes it work under https

curl_setopt($ch, CURLOPT_CAFILE, '/ca-bundle.crt')

curl_setopt($ch, CURLOPT_POST, 1); // set POST method

curl_setopt($ch, CURLOPT_POSTFIELDS, "login=testing&password=hello"); // add POST fields

$result = curl_exec($ch); // run the whole process

curl_close($ch);

echo $result;

?>

 

 

that is the code i'm using. Why do i get blank page with this? Rapidshare requires HTTPS authentication. Can someone help me out here?

Link to comment
https://forums.phpfreaks.com/topic/50367-curl-problem/
Share on other sites

Im not sure on how you are using this

curl_setopt($ch, CURLOPT_POSTFIELDS, "login=testing&password=hello"); // add POST fields

I think it should be

    // this array will hold the field names and values
   $postdata=array(
     "var1"=>"val1", 
     "var2"=>"val2",
     "var3"=>"val3", 
   );
   // tell curl we're going to send $postdata as the POST data
   curl_setopt ($crl, CURLOPT_POSTFIELDS, $postdata);

Link to comment
https://forums.phpfreaks.com/topic/50367-curl-problem/#findComment-247473
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.