mridang_agarwal Posted May 7, 2007 Share Posted May 7, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/50367-curl-problem/ Share on other sites More sharing options...
neel_basu Posted May 7, 2007 Share Posted May 7, 2007 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); Quote Link to comment https://forums.phpfreaks.com/topic/50367-curl-problem/#findComment-247473 Share on other sites More sharing options...
mridang_agarwal Posted May 8, 2007 Author Share Posted May 8, 2007 nah. that doesnt seem to be i. I tried my code with some other sites that required POST and my code worked. Quote Link to comment https://forums.phpfreaks.com/topic/50367-curl-problem/#findComment-247733 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.