简体   繁体   English

用curl下载此链接的代码

[英]Code to download this link with PHP curl

This link 这个连结

http://ajaxcontroltoolkit.codeplex.com/releases/view/11121#DownloadId=28808 http://ajaxcontroltoolkit.codeplex.com/releases/view/11121#DownloadId=28808

shows a popup on which one has to agree before being able to download. 显示了一个弹出窗口,必须先同意该弹出窗口才能下载。

So how to automate this with PHP curl ? 那么如何使用PHP curl自动执行此操作? Any existing similar sample code ? 任何现有的类似示例代码?

If you take a look at what's happening when you click on the "I agree" button with a tool like Live HTTP Headers , you'll see that : 如果您使用Live HTTP Headers之类的工具查看“我同意”按钮时的情况,您将看到:

  • When you click on the " I agreee " button, it sends an HTTP POST request 当您单击“ 我同意 ”按钮时,它将发送一个HTTP POST请求
    • to http://ajaxcontroltoolkit.codeplex.com/releases/acceptLicense http://ajaxcontroltoolkit.codeplex.com/releases/acceptLicense
  • That HTTP request returns a 302 response, 该HTTP请求返回302响应,
    • with a Location HTTP header that points to http://download.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=AjaxControlToolkit&DownloadId=28807&FileTime=128487916929600000&Build=16331 带有指向http://download.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=AjaxControlToolkit&DownloadId=28807&FileTime=128487916929600000&Build=16331Location HTTP标头
    • which is the adress from which your browser is actually downloading the file. 浏览器实际从中下载文件的地址。

(see there for the HTTP headers of that exchange ) (请参阅此处以获取该交换HTTP标头


It doesn't seem to be any other kind of control/security... 似乎没有任何其他类型的控制/安全性...
So, downloading from that URL with curl should work, I'd say. 因此,可以说从带有curl的URL下载应该可以。

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

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