开发者

readfile() fails because of SSL

开发者 https://www.devze.com 2023-03-09 02:45 出处:网络
I\'m using readfile() to serve a download from Rapidshare\'s API through my server. This is the relevant code:

I'm using readfile() to serve a download from Rapidshare's API through my server. This is the relevant code:

readfile("http://rs$server_id$short_host.rapidshare.com/cgi-bin/rsapi.cgi?sub=download&fileid=$file_id&filename=$file_name&login={$account['username']}&password={$account['password']}");

But when I request the page, I get this error:

Warning: readfile(http://rs869l34.rapids开发者_开发知识库hare.com/cgi-bin/rsapi.cgi?sub=download&fileid=3457766962&filename=some_file.rar&login=mylogin&password=mypassword) [function.readfile]: failed to open stream: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? in C:\xampp\htdocs\dl\downloaders\rapidshare_com.php on line 25

According to the Rapidshare API, there's no way to stop it returning an SSL response.

Do I need to configure some special wrapper to handle this or something?

Thanks for any help!


libCurl is used to download file from a remote server like as readfile(http://....).

Though it can handle finer details like as cookie, post and ssl certificates. read more at http://cn.php.net/manual/en/book.curl.php

enable curl in php.ini and try the following code :

$ch=curl_init("http://rs$server_id$short_host.rapidshare.com/cgi-bin/rsapi.cgi?sub=download&fileid=$file_id&filename=$file_name&login={$account['username']}&password={$account['password']}");
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,true); // follow http redirect
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,true); //temporary ignore certificate error for easier testing
$data=curl_exec($ch);
0

精彩评论

暂无评论...
验证码 换一张
取 消