简体   繁体   English

Rapidgator API直接下载链接错误

[英]Rapidgator API Direct Download Link Error

Guys, I am currently working on file hosting premium link generator basically it will be a website from where you can get a premium link of uptobox,rapidgator,uploaded.net and other file hosts sites without purchasing the premium account. 伙计们,我目前正在研究文件托管高级链接生成器,基本上它将是一个网站,您无需购买高级帐户即可从该网站获得uptobox,rapidgator,uploaded.net和其他文件托管站点的高级链接。 Basically, We are purchasing the accounts of this website on behalf of the users and offering this service at a low price. 基本上,我们代表用户购买此网站的帐户,并以低价提供此服务。 So when I was setting up API of direct download link of rapidgator I was able to get that link but I was getting session is over. 因此,当我设置Rapidgator的直接下载链接的API时,我可以获取该链接,但会话已结束。 I was trying to that API via a software, not via manual coding and I am facing this problem 我正在尝试通过软件而不是通过手动编码来使用该API,而我正面临着这个问题

So I have been getting Rapidgator API reference from Tihs Site:- https://gist.github.com/Chak10/f097b77c32a9ce83d05ef3574a30367d 所以,我已经从Tihs网站获得Rapidgator API参考: - https://gist.github.com/Chak10/f097b77c32a9ce83d05ef3574a30367d

So I am doing the following Thing With My Debugging Software And I am getting success response but when I just open that URL in my browser it shows Session Id Failed. 因此,我正在使用调试软件执行以下操作,并且获得了成功响应,但是当我在浏览器中打开该URL时,它显示会话ID失败。

So Here Are Steps What I am Doing Sending a post request on https://rapidgator.net/api/user/login with username and data and I am getting this output 所以这是我正在做的步骤在https://rapidgator.net/api/user/login上发送带有用户名和数据的发帖请求,并且我正在获取此输出

{"response":{"session_id":"g8a13f32hr4cbbbo54qdigrcb3","expire_date":1542688501,"traffic_left":"13178268723435"},"response_status":200,"response_details":null}

Now I am sending a get request (I tried Post Request Too But the Same Thing Happened) on this url with session id and URL embedded in URL https://rapidgator.net/api/file/download?sid= &url= and I am getting this output 现在,我在此URL上发送了一个get请求(我尝试了“过分发布请求”,但发生了同样的事情),会话ID和URL嵌入在URL https://rapidgator.net/api/file/download?sid=&url =中,我正在获得此输出

{"response":{"url":"http:\/\/pr56.rapidgator.net\/\/?r=download\/index&session_id=uB9st0rVfhX2bNgPrFUri01a9i5xmxan"},"response_status":200,"response_details":null}

When I try to download the file from the Url through my browser It says Invalid Session and sometimes too many open connections error 当我尝试通过浏览器从网址下载文件时,显示“会话无效”,有时打开连接错误过多

Link of the error:- https://i.imgur.com/wcZ2Rh7.png Success Response:- https://i.imgur.com/MqTsB8Q.png 错误链接: -https : //i.imgur.com/wcZ2Rh7.png成功响应:-https: //i.imgur.com/MqTsB8Q.png

Rapidgator needs its api to be hit three times with different URLs. Rapidgator需要使用不同的URL将其api击中3次。

 $cookie = $working_dir.rand();
 $headers = array("header"=>"Referer: https://rapidgator.net");

     $ch = curl_init();
           curl_setopt($ch, CURLOPT_URL, "http://rapidgator.net/api/user/login");
           curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
           curl_setopt($ch, CURLOPT_POSTFIELDS, "username=email@domain.ext&password=myplaintextpassword");
           curl_setopt($ch, CURLOPT_POST, 1);
           curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
           curl_setopt($ch, CURLOPT_HEADER, 0);
           curl_setopt($ch, CURLOPT_VERBOSE, 0);
           curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
           curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
           curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
           curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
           curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
           curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
 $result = curl_exec($ch);
           curl_close ($ch);

 $rapidgator_json = json_decode($result,true);
 return array($rapidgator_json['response']['session_id'],$cookie);

http://rapidgator.net/api/user/login (this is the initial login) Above link gives you a session id that you need. http://rapidgator.net/api/user/login (这是初始登录)上面的链接为您提供了所需的会话ID。 The response is in JSON 响应为JSON

Now we need to request a download link that will allow us to download without having to log in to a human input form. 现在,我们需要一个下载链接,该链接将使我们无需登录到人工输入表单即可进行下载。 So we will use its api to request a download link using the intial session id we got from the 1st url. 因此,我们将使用其api来使用从第一个网址获得的初始会话ID请求下载链接。

 $headers = array("header"=>"Referer: http://rapidgator.net/api/user/login");

     $ch = curl_init();
           curl_setopt($ch, CURLOPT_URL, "http://rapidgator.net/api/file/download?sid=$rapidgator_session&url=$rapidgator_file");
           curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
           curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
           curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
           curl_setopt($ch, CURLOPT_HEADER, 0);
           curl_setopt($ch, CURLOPT_VERBOSE, 0);
           curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
           curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
           curl_setopt($ch, CURLOPT_COOKIEJAR, $working_dir.$rapidgator_cookie);
           curl_setopt($ch, CURLOPT_COOKIEFILE, $working_dir.$rapidgator_cookie);
           curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
           curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
 $result = curl_exec($ch);
           curl_close ($ch);

 $rapidgator_json = json_decode($result,true);
 return array($rapidgator_json['response']['url']);

Basically, we pass the session id Rapidgator gave us assuming you have properly passed a valid account. 基本上,我们通过Rapidgator给我们提供的会话ID,前提是您已正确通过了一个有效的帐户。 Then we include the source url you had obtained (Link to file) http://rapidgator.net/api/file/download?sid=$rapidgator_session&url=$rapidgator_file 然后,我们包含您获得的源URL(链接到文件) http://rapidgator.net/api/file/download?sid=$rapidgator_session&url=$rapidgator_file

After that. 之后。 Rapidgator will return a JSON response with an url that u can use to obtain the file in question. Rapidgator将返回带有URL的JSON响应,您可以使用该URL来获取相关文件。 This allows you to use whatever download method you want as that link is a session url is valid for a short period of time. 这使您可以使用所需的任何下载方法,因为该链接是会话URL,在短时间内有效。

$rapidgator_json['response']['url']

All code above is somewhat incomplete. 上面的所有代码都不完整。 Some extra checks on the json responces for possible errors/limits are recommended. 建议对json响应进行一些额外的检查,以了解可能的错误/限制。 I used functions on my end but this is enough for you to see what you should be doing. 我最终使用了函数,但这足以让您了解应该做什么。 Rapidshare API has other data that can be useful in determining if you have gone over your daily quota. Rapidshare API还有其他数据,可用于确定您是否超出了每日配额。 How long the session url is going to last and so on. 会话网址将持续多长时间等等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM