The basic steps for building a PHP collection program are:
What is a collection program? Get Remote Data (text, pictures, pictures) and quickly save to a local or specified address.
such as weather Forecast (thief procedure):
Remote access-"Replace content-" show to users
such as real-time updates of news (capture content):
Remote access--"Extract content-" Classified storage-"Read content---" Display content
*************************
Design PHP to collect inbound UML
List Regular:
The terminal is regular:
**************************
file_get_contents () Get remote page content
Preg_match_all () match list
Preg_match () matching terminal
Preg_replace (): Filter terminal
**************************
Create a new list file: lb.php
echo $con =file_get_cotents ($_get[url]);
$preg = "#
Pg_match_all ($preg, $conn, $arr);
foreach ($arr [1] as $id = + $v) {
echo $v. " "Arr[2][$id]." <br> ";
}
New VI. PHP Get title
vi.php
$con =file_get_contents ();
$preg = "<title> (. *) </title>/ius";//case insensitive, prevent greedy match, prevent line break
Echo ZZ ($preg, $con);
Function zz ($preg, $con, $num =1) {
Preg_match ($preg, $con, $arr);
return $arr [$num];
}
echo $arr [1];//get title
echo "<a href=vi.php?url=". $v. " > ". arr[2][$id]." <br> ";
======================================
PHP100:83: Acquisition Program
lb.php
<?php
if ($_get[id]) {
$con =file_get_cotents ($_get[url].$_get[id]. " sHTML ");
$preg = "/
Perg_match_all ($preg, $conn, $arr);
foreach ($arr [1] as $id = + $v) {
echo $v. " "Arr[2][$id]." <br> ";
}
$_get[id]++;
echo "<script>location.href= ' lb.php?id= '. $_get[id]." </script> ";
}
?>
Http://www.xinhuanet.com/finance/tzxx.htm
===============================================================
Operation Steps:
1. Create a new Database Caiji,tep_url table, id,title,content,11, 100,150
2. Create a new conn.php, insert the statement can be inserted by phpMyAdmin a statement simple to get
3. Create a new vi.php
4. Get the next article in a single storage.
List of temporary paths:
Perfect my inbound table.
What if you delete one of the ID values? Removed the 9th article!
Add a statement
$sql 2= "SELECT * from Tmp_url where id> ' $gid ' ORDER by ID ASC Limit 1
This article is from "Pico Zhang" blog, please make sure to keep this source http://raojiadashaoye.blog.51cto.com/7167615/1426141