本文介绍了如何自动收集数据,而不是冻结在10%的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

//pastebin.com/virLR7dFrel =nofollow> http://pastebin.com/virLR7dF )

(看看我的情况的图像:)



我有一个PHP脚本来抓取给定的网站,并将数据提取为变量:

  $ ID =data; //这只是一个例子
$ name =data;
$ price =data;
$ image =data;

脚本会将这些数据放在MySQL数据库中。



什么是错的?

我可以用for循环自动执行它,所以我会一次获得更多的数据。但是如果我循环100万次,我的脚本会在某个时候冻结,从(找到它从哪里开始,从那里开始)有问题。



PHP / JS如何使它: / b>

2。停止并显示有关收集的资料的信息。 收集下面10个部分的数据

4。停止并添加新的信息到以前显示的信息

* 有一个PAUSE功能,可以在收集下一部分后停止。

* 输入缓冲可能会帮助你在PHP



试试&


What I have:

(take a look or fire on localhost if required: http://pastebin.com/virLR7dF)

(take a look on image presenting my case: http://iv.pl/images/47143498348127804676.png)

I have a PHP script that crawles given websites, and extracts data as varibles:

$ID = "data"; //this is just an example
$name = "data";
$price = "data";
$image = "data";

Script will put this data in a MySQL DB.

What is wrong?

I can automate it with a for loop so I will get more data at once. But if I loop it 1,000,000 times my script will freeze at some point, and starting over (finding where it broke and starting from that point) is problematic.

How with PHP/JS make it to:

1. gather 10 portions of data

2. stop and display information about gathered data

3. gather next 10 portions of data

4. stop and add new information to previosly displayed information

* have a PAUSE function to stop after next portion gathered

* have a RESUME funcion to start after last portion gathered

解决方案

Output Buffering might be helping you in PHP

Try ob_start & ob_flush

这篇关于如何自动收集数据,而不是冻结在10%的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 01:43