有很多类似的链接。现在就是要把这所有的ed2k链接都保存下来,然后批量下载,而不用一个一个点击下载。

实际上就是对应的是:

现在要做的就是取回相关文件下的除了灰色部分的所有链接对应的页面内容,再从中取出相应的ed2k链接。

运行环境如下:

OS:Win7 Professional 64bit

Zend Studio 8.0.1

Zend Server Communication Edition: 5.5.0

代码如下:

index.html

Input the initial url

Please input initial url:

Example:http://www.verycd.com/files/7497c692fc812558e5ba0fc78d84fbf8310530048

main.php

ob_start();

set_time_limit(0);

$url = $_POST["initial_url"];

//$url = "http://www.verycd.com/files/fb07beed85d207aa756abc998afecc9693668604";

echo "Original url:
".$url."
";

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_HEADER, 0);

$content_fetched = curl_exec($ch);

if(false == $content_fetched)

{

echo "Sorry, the request is error! Please try again!
";

exit;

}

curl_close($ch);

$pattern = '#

preg_match_all($pattern, $content_fetched, $matches);

$ed2k_abstracted = array();

echo "Abstracted ed2k links as follows:
";

$all_ed2k_links = "";

$ch = curl_init();

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_HEADER, 0);

for($i = 0; $i < count($matches[1]); $i++)

{

curl_setopt($ch, CURLOPT_URL, $matches[1][$i]);

$content_fetched = curl_exec($ch);

/*

*

* name="ed2k://|file|%5B%E8%BF%88%E5%85%8B%E5%B0%94%E6%9D%

* B0%E5%85%8B%E9%80%8A%E7%8F%8D%E8%B4%B5%E7%BD%95%E8%A7%81

* %E8%A7%86%E9%A2%91%E5%90%88%E9%9B%86%5D.Michael.Jackson.

* -.%5B01.American.Music.Awards.Dangerous.1993%5D.mv.mpg|3

* 10530048|7497c692fc812558e5ba0fc78d84fbf8|h=XMDFNICTGCNK

* X7AXRHTURXVBBAWXSRZF|/" id="downloadButton"

* value="点击下载" />

*/

$pattern = '#ed2k[^"]+#i';

preg_match($pattern, $content_fetched, $match);

$ed2k_abstracted[] = $match[0];

//Display them in the screen.

echo "".$i.":".$match[0]."
";

$all_ed2k_links = $all_ed2k_links . $match[0]."\n";

}

curl_close($ch);

ob_end_flush();

/*

* Save as ed2k_abstracted.txt.

*/

file_put_contents("ed2k_abstracted.txt", $all_ed2k_links, FILE_APPEND);

然后出现的很奇怪的问题:

首先碰到了php运行超时的问题。调试的时候一点儿问题都没有,运行的时候就是显示不出来结果。后来在main.php中增加set_time_limit(0);语句,结果还是不对,总是弹出一个main.php的对话框。查找各种日志文件后,在C:\Program Files (x86)\Zend\ZendServer\logs\ZendEnabler.log发现以下错误:

Request timed out during the communication with the PHP process。

重要摘抄如下:

A Server Error Appears During a Long Debug Session

Article ID: 476

Last updated: 27 Oct, 2010

Views: 3379

This article applies to:

[ Zend Server x.x, Zend Studio x.x ]

[ Windows ]

Symptom

An error message appears when remotely debugging a PHP application running on a Windows server. Depending on the Web server, the error is either the standard HTTP Error 500 or the Open/Save dialog prompting you to save an empty file:

Technical Details

This problem happens only on Windows with Zend Server installed and the PHP code is handled by FastCGI on this platform. The available FastCGI implementations are very limited in their ability to communicate with the Web server on one side, and with the PHP-CGI process on the other side. Therefore, during a long debug session the FastCGI process may reach its timeout while waiting for PHP to complete the debug session. The FastCGI may then return an error to the Web server even though the PHP process is still working.

Resolution / Workaround

To workaround this limitation, the user can increase the timeout value to a reasonably high number, thus eliminating the possibility that a timeout will occur. The instructions for all supported Web servers are given below. In all cases, restart the Web server after making the change.

Apache

If Zend Server is installed with the bundled Apache Web server, it uses the FastCGI component called Zend Enabler. Edit the configuration file of Zend Enabler as it appears in the below Listing (the timeout value is shown in bold):

Listing of

\etc\ZendEnablerConf.xml :

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:noNamespaceSchemaLocation="ZendEnablerConf.xsd">

verbosity="0" maxFileSizeKB="100" />

value="C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Zend\MySQL51\bin;C:\Program Files\Zend\ZendServer\bin" />

commandLine="C:\Program Files\Zend\ZendServer\bin\php-cgi.exe"

impersonation="true">

然后定位到该文件,修改

It works! Great!

php 下载地址提取,PHP提取emule下载ed2k链接相关推荐

  1. Qt软件下载地址(开源,免费下载,解决方案)

    Qt软件各个版本下载(从1到5系列) 包括64位,32位,单独使用版本mingw,和VS结合使用版本msvc,区别在于使用的编译器不一样. msvc是指微软的VC编译器,MinGW是指是Minimal ...

  2. python教程app下载地址_Python爬取APP下载链接的实现方法

    首先是准备工作 Python 2.7.11:下载python 其中python2和python3目前同步发行,我这里使用的是python2作为环境.Pycharm是一款比较高效的Python IDE, ...

  3. oracle数据库12下载地址,Oracle 数据库和补丁下载地址 12.1.0.2 11.2.0.4 11.2.0.1

    Oracle 数据库和补丁下载地址 12.1.0.2 11.2.0.4 11.2.0.1  AIX Linux Windows平台 AIX 12.1.0.2 DATABASE DB 数据库软件介质下载 ...

  4. ORACLE 10g下载|ORACLE 10g下载地址|ORACLE 10g官网下载地址

    ORACLE 10g下载地址 oracle 下载还需要用户名我自己注册了个方便大家使用下载 user:wangdetian168@gmail.com pass:qwe123QWE 密码是这个 一般不会 ...

  5. Visual Studio 2013 下载地址 V12各种版本官方下载网址

    Microsoft Visual Studio Ultimate 2013(简体中文旗舰版) 简体中文版下载地址:http://download.microsoft.com/download/0/7/ ...

  6. Visual Studio 2008 下载地址 V9各种版本官方下载网址

    Visual Studio 2008 Professional 简体中文版下载地址:http://download.microsoft.com/download/e/7/7/e777851c-c1a4 ...

  7. Visual Studio 2005 下载地址 V8各种版本官方下载网址

    Visual Studio 2005 Professional 简体中文版下载地址:http://download.microsoft.com/download/5/c/2/5c2840fd-8b03 ...

  8. Visual Studio 2010 下载地址 V10各种版本官方下载网址

    Visual Studio 2010 Professional 简体中文版下载地址:http://download.microsoft.com/download/1/4/3/143B7583-6225 ...

  9. python下载地址到迅雷qq旋风下载

    迅雷和qq旋风下载,有加速和离线功能,非常方面,我是在网上看到的原始地址和迅雷地址,qq旋风地址的转化原理.然后用python+pyqt写了一个client 原理: 迅雷: 迅雷下载地址=" ...

  10. 统计学基于SPSS贾俊平 授课笔记 发布作业 spss19cn 软件下载地址及破解包spss19_10039 下载地址...

    spss19cn软件下载地址及破解包spss19_10039 软件包下载地址一 http://www.33lc.com/soft/41991.html 软件包下载地址二 http://dl.pconl ...

最新文章

  1. 如何无侵入管理所有的微服务接口?
  2. au vst插件_失真效果音频插件
  3. eclipse 鲜为人知的调试技巧,你用过多少
  4. oracle和mysql的安装教程_客户端安装和配置(1) - Oracle 10g 安装图解教程_数据库技术_Linux公社-Linux系统门户网站...
  5. Asp.Net Core 轻松学-正确使用分布式缓存
  6. python --动态类型
  7. 打破AI算力瓶颈,华为升级“智能计算”重塑IT行业
  8. [转载] 在IPython中重新加载模块 importlib
  9. (可更新)计算机算法设计与分析 第4版 (王晓东) 课后答案[1-9章]
  10. linux定时器时间轮算法详解
  11. oracle序列可以创建同义词吗,Oracle基础教程:同义词与序列
  12. vue3 组件naiveui报错: Extraneous non-props attributes (class) were passed to component but could not be
  13. element-ui手风琴自定义html,element-ui中el-table expand 手风琴效果,展开里面的内容或者ta...
  14. 自己实现Lock(独享锁)
  15. linux 启用dhcp服务器,linux下DHCP服务器配置
  16. 红米是个失败,雷军是个笨蛋
  17. 干涉法测微小量实验_干涉法测微小量
  18. rust和gta5哪个吃配置_10款游戏体感嗨翻天的Steam大作,GTA5险无缘榜单,吃鸡仅排第三...
  19. SpringBoot文件上传和下载
  20. zabbix搭建完,web端显示“zabbix服务器端运行中 不”

热门文章

  1. wii游戏wuyou_如何备份,交换和更新Wii游戏的保存内容
  2. C语言实现猜数字游戏(通俗易懂)
  3. TurnipBit:和孩子一起动手DIY“滚动”的生日礼物
  4. maven下载不到源码:Cannot download sources Sources not found for:
  5. Spring中开启组件扫描细节配置
  6. 使用腾讯云服务器的windows系统搭建CSGO服务器
  7. C# wpf 使用ffplay实现视频播放器
  8. 卷积神经网络 图像处理,卷积神经网络图像识别
  9. oracle ebs wsh picking batch,OracleEBSShipping(WSH)模块日志收集方法
  10. 小程序公告php实现,小程序两种滚动公告栏的实现方法