Php's question about loops! (Collecting webpage content) I am working on a small program for collecting Forum content,
This is the way to challenge web page collection.
If ($ _ GET [id] <= 130000 & $ _ GET [id]) {
$ Url = "http://bbs.misranim.com/thread-". $ _ GET [id]. "-1-1.html ";
However, I used the while loop for convenience.
$ P = 0;
While ($ p <= 130000 ){
$ Url = "http://bbs.misranim.com/thread-". $ p. "-1-1.html ";
$ P ++;
The problem arises. each time a blank page is deleted, the content is collected to the database.
When you use if ($ _ GET [id] <= 130000 & $ _ GET [id]), the deleted blank page is skipped directly,
When the while or for loop is used, this problem occurs when the deleted blank page is encountered.
Figure: copy the content of the previous page directly when an empty page is encountered. for example, if 13th posts have content, but 14th to 17 posts are empty pages deleted, it will add the content of 13 posts to these posts, and the content will be similar later!
When you use if ($ _ GET [id] <= 130000 & $ _ GET [id]), the deleted blank page is skipped directly.
There are no content in the last few of the 13 posts, so I jumped to the first post.
I want this effect.
Yes
If (strlen ($ txt)> 5) // The content is large and 5 characters are collected to the database.
{
$ Db-> insert ("insert into bbs_caiji (col_date, title, txt, url, type, source) VALUES ('". $ col_date. "','". $ title1 ."','". $ txt. "','". $ url. "', 'bbs', 'misranim ')");
}
Why does this problem occur when the while and for loops are used?
Reply to discussion (solution)
The first line is jump not a challenge.
This should not happen.
Generation? Incomplete, only look at the generation provided? Yes? Yes ?? .
Every cycle? And then clear all the $ txt files? Null ??.