Idea: The idea of collecting [url = javascript:;] program [/url] is simple and can be roughly divided into the following steps: 1. getting remote files
Ideas:
The idea of collecting [url = javascript:;] program [/url] is simple and can be divided into the following steps:
1. obtain the remote file source code (file_get_contents or fopen ).
2. analyze the code to get the content you want (regular match is used here, and paging is generally used ).
3. download and import the content obtained from the root, and perform other operations.
Here, the second step may have to be repeated several times. for example, you need to analyze the paging address first and analyze the content of the internal page to get what we want.
Code:
I have recorded some of the code from the previous sending Part. today I am here to make a simple sending part.
Copy the [url = javascript:;] PHP [/url] content to the clipboard. PHP code:
@ $ Nl = file_get_contents ($ rs ['URL']); // capture remote content
Preg_match_all ("/var url = \" gameswf \/(.*?) \. Swf \ ";/is", $ nl, $ connect); // perform a regular match to obtain the desired content.
[Url = javascript:;] mysql [/url] _ query ("insert... insert [url = javascript:;] database [/url ");
The above code is all the code used for collection. of course, you can also use fope. I personally prefer file_get_contents.
Below, I will share my method of downloading the image flash to the local device. it's too easy to copy the PHP content to the clipboard using two lines of code:
If (@ copy ($ url, $ newurl )){
Echo 'OK ';
}
Previously, I sent a [url = javascript:;] image [/url] to download [url = javascript:;] the function [/url] will also be used to copy the PHP content to the clipboard. PHP code:
/* Function for saving images */
Function getimg ($ url, $ filename ){
/* Determine whether the image url is empty. if it is empty, stop the function */
If ($ url = ""){
Return false;
}
/* Get the image extension and save it to the variable $ ext */
$ Ext = strrchr ($ url ,".");
/* Determine whether the image file is valid */
If ($ ext! = ". Gif" & $ ext! = ". Jpg "){
Return false;
}
/* Read the image */
$ Img = file_get_contents ($ url );
/* Open the specified file */
$ Fp = @ fopen ($ filename. $ ext, "");
/* Write the image to the pointing file */
Fwrite ($ fp, $ img );
/* Close the file */
Fclose ($ fp );
/* Return the new image file name */
Return $ filename. $ ext;
}