Php generates googlemap code-PHP source code

Source: Internet
Author: User
Tags temporary file storage
Ec (2); php generates googlemap code & lt; title & gt; GoogleSitemap builder & lt; title & gt; & lt; styletype & quot; textcss & quot; & gt; & lt ;! --. Agreement {& nbsp; border: 1 pxsolid #666666;}. green {& nbsp; color: #00CC00 script ec (2); script

Php generates google map code

Google Sitemap Builder

Script
Var MyMar;
Function monitoring ()
{
If (document. readyState = 'complete ')
{
Window. location = '? I = '+ query_get ();
}
}

Function query_get ()
{
Var querystr = window. location. href. split ("= ");

If (! Number (querystr [1])
{
Var value = 0;
} Else {
Var value = Number (querystr [1]);
}

Return Number (value) + 1;
}

MyMar = setInterval ('monitoring () ', 3000 );
Script









Searching:



/* ===================================================== ==================================
= Copyright agreement:
= GPL ()
= ------------------------------------------------------------
= Abstract: URL collection function PHP5
= Version 1.0
= ------------------------------------------------------------
= Open source tracing project team
= Updated by: jd808
= Last date:
========================================================== =================================== */

$ File = 'sitemap. xml'; // The temporary URL of the home page is used to store files when the files required by GOOGLE are executed.
$ Temp_file = 'temp. xml'; // temporary file storage in the URL of the inner page
$ Url = "http://www.gyqpw.com/"; // the website to search
$ Timea = time (); // you can ignore the preceding three parameters.
If (! $ _ GET ['I'])
{
File_put_contents ($ file ,'');
File_put_contents ($ temp_file ,'');
File_put_contents ($ file, con ($ url, $ timea ));

Echo "script"
Window. location = '? I = bak ';
Script ";
} Else {
Consts ($ _ GET ['I'], $ timea, $ file, $ url );
}
Function con ($ url, $ timea) // Control
{
Echo "script"
Document. getElementById ('link'). innerHTML = 'collecting information for ". $ url! ';
Script ";

$ Str = file_get_contents ($ url );

$ Collection_url = collection_url ($ str, $ url );

$ Collection_url = array_flip ($ collection_url );
Foreach ($ collection_url as $ key => $ value)
{
If (count (explode ($ url, $ key) = 2)
{
$ Strurl. = $ key. "\ n ";
}
}

Return $ strurl;
}
Function consts ($ I, $ timea, $ file, $ urlys)
{
$ Str = file_get_contents ($ file); // read page data and produce strings

$ Url = explode ("\ n", $ str );

$ Sum = count ($ url)-1;

If ($ I = 'bak ')
{
$ I = 0;
}

/* Progress bar */
$ Wid = round ($ I/$ sum * 100,2). "% ";
$ P ="

$ Wid

";
Echo 'script'
Document. getElementById ("scroll"). innerHTML = "'. $ p .'";
Script ';

Ob_flush (); // release the cache
Flush (); // send data that is no longer cached to the browser
/* Progress bar END */

For ($ j = $ I; $ j <$ sum; $ j ++)
{
If (! $ Url [$ j])
{
Continue;
}

If (! Detection_url ($ url [$ j]) // check whether the URL is valid
{
Continue;
}

$ Timeb = time (); // trace time
If ($ timeb-$ timea)> = 25)
{
Memory ($ collection_url, $ j); // stores data
}
/* URL display trace */
Echo "script"
Document. getElementById ('link'). innerHTML = '". $ url [$ j]."';
Script ";
Ob_flush (); // release the cache
Flush (); // send data that is no longer cached to the browser
/* The END Of The URL display trace */
$ Urlstr = @ file_get_contents ($ url [$ j]);

$ Collection_url [] = collection_url ($ urlstr, $ urlys );

$ Timec = time (); // trace time
If ($ timec-$ timea)> = 25)
{
Memory ($ collection_url, $ j); // stores data
}

If ($ j = $ sum-1)
{
Memorys (); // stores data mainly to generate formal xml
}
}
}
Function collection_url ($ str, $ url) // collect the URL and return an array (mainly page)
{
Preg_match_all ('/
$ Urlexp = $ matches [1];

For ($ j = 0; $ j {
$ Urlexp [$ j] = ltrim (str_replace ("\ r \ n", '', $ urlexp [$ j]);
$ Urlexp [$ j] = ltrim (str_replace ("\ n", '', $ urlexp [$ j]);
$ Urlexp [$ j] = ltrim (str_replace ("\ r", '', $ urlexp [$ j]);

If ($ urlexp [$ j] = '#')
{
Continue;
}

If ($ urlexp [$ j] = '/#')
{
Continue;
}

If (! Strchr ($ urlexp [$ j], 'HTTP ://'))
{// No http ://
$ Urlall [] = $ url. $ urlexp [$ j];
Echo $ url. $ urlexp [$ j].'
';
Print "script document. getElementById ('logs'). scrollTop = document. getElementById ('logs'). scrollHeight; script";
Ob_flush (); // release the cache
Flush (); // send data that is no longer cached to the browser

} Else {
If (count (explode ($ url, $ urlexp [$ j]) = 2)
{
$ Urlall [] = $ urlexp [$ j];

Echo $ urlexp [$ j].'
';
Print "script document. getElementById ('logs'). scrollTop = document. getElementById ('logs'). scrollHeight; script";
Ob_flush (); // release the cache
Flush (); // send data that is no longer cached to the browser
} Else {
Unset ($ urlexp [$ j]);
}
}
}
Return $ urlall; // return the array obtained by searching on this page
}
Function memory ($ collection_url, $ I)
{

Global $ temp_file;

If (is_array ($ collection_url ))
{
For ($ h = 0; $ h {
For ($ l = 0; $ l {
$ Strts. = $ collection_url [$ h] [$ l]. "\ n ";
}

}

$ Wstr = file_get_contents ($ temp_file );

File_put_contents ($ temp_file, $ wstr. $ strts );

If ($ I = 0)
{
$ I = 2;
}

$ K = $ I-1;

Echo "script"
Window. location = '? I = ". $ k ."';
Script ";
Exit;
}
}
Function memorys () // generates the formal xml
{
Global $ temp_file, $ file;

$ File_arr = array_flip (file ($ file ));

$ Temp_file_arr = array_flip (file ($ temp_file ));

$ Xmla =' '. "\ R \ n ".' ';

$ Xmlc = "\ r \ n ";

Foreach ($ file_arr as $ keya => $ valuea)
{
$ Keya = ltrim (str_replace ("\ r \ n", '', $ keya ));
$ Keya = ltrim (str_replace ("\ n", '', $ keya ));
$ Keya = ltrim (str_replace ("\ r", '', $ keya ));

$ Xml. ='
'. $ Keya .'
'. Date ("Y-m-d", time ()).'
Daily
';
}

Foreach ($ temp_file_arr as $ keyb => $ valueb)
{
$ Keyb = ltrim (str_replace ("\ r \ n", '', $ keyb ));
$ Keyb = ltrim (str_replace ("\ n", '', $ keyb ));
$ Keyb = ltrim (str_replace ("\ r", '', $ keyb ));

$ Xml. ='
'. $ Keyb .'
'. Date ("Y-m-d", time ()).'
Daily
';
}

$ Strts = $ xmla. $ xml. $ xmlc;

File_put_contents ($ file, $ strts );

Echo "script"
ClearInterval (MyMar );
Document. getElementById ('link'). innerHTML = 'url has been collected! ';
Document. getElementById ('all _ a'). innerHTML =' XML generation completed!';
Script ";
}
Function detection_url ($ url)
{
If (strrchr ($ url, '= '))
{
Return true;
}

If (substr ($ url, strlen ($ url)-1, 1) = '/')
{
Return true;
}

$ Postfix = strrchr ($ url ,'.');

Switch ($ postfix)
{
Case ". php ":
Return true;
Break;

Case ". html ":
Return true;
Break;

Case ". htm ":
Return true;
Break;

Case ". asp ":
Return true;
Break;

Case ". aspx ":
Return true;
Break;

Case ". shtml ":
Return true;
Break;
}
Return false;
}
?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.