Previously saw people on the site of the content is automatically updated every day, think this technology is magical.
Also have been wondering why their website is not big, it is impossible to have their own forecast center,
But the weather forecast is automatically updated every day, and then learned from others, it is because there is a thief program this thing exists ~
The thief procedure says the good point is collects the procedure, collects other people's website the information to own website.
The principle of the acquisition program is to use regular expressions to match and replace the content read from other sites, and then display to their own site.
Let's say I use a PHP regular expression to implement a weather-forecasting thief program.
Target site: * * Weather Forecast Network
Reason: Code is not many, it is easier to find relevant content to do intercept positioning
Implementation steps:
① read ask Skynet Web content with string
Use the PHP function $str=file_get_contents ("url"), read the contents of the target Web page and assign the value to the $STR variable
② matches the required content with regular expression function eregi
Eregi ("Regular expression", "matched string $str", "return value");
③ Find and replace some content
Use the $str2=str_replace ("replaced string", "replaced by the word string", "original Strings");
Using the string substitution function here is to replace the path of the picture of the weather forecast status, so that the picture can be displayed normally
④ output to the Web page
echo $str 2;
Ok~ to this a simple thief program is done.
The following is the final effect:
http://www.bkjia.com/PHPjc/478607.html www.bkjia.com true http://www.bkjia.com/PHPjc/478607.html techarticle previously saw people on the site of the content is automatically updated every day, think this technology is magical. Also have been wondering why their website is not big, also can not have their own weather forecast pre ...