Use Feixin to send a weather forecast text message to yourself (which has just been written and is effective) php code
Geturlfile ($ url); // get content $ start =''; $ End ='
'; $ Content = $ gather-> get_sub_content ($ html, $ start, $ end); $ text = substr (SpHtml2Text ($ content), 42 ); // load the flying mail class (search for the class itself on the Internet) require '. /lib/PHPFetion. php '; // mobile phone number, fetion password $ fetion = new PHPFetion ('xxxxxxxxxxxxxxxx', 'xxxxxxxx'); // sent number, and weather forecast information $ fetion-> send ('20140901', $ text); echo 'OK! Sent successfully! ';/*** Collection class */class gather {public $ pagestring = ''; private $ db; function _ construct () {global $ db; $ this-> db = $ db;} function geturlfile ($ url) {$ url = trim ($ url); $ content = ''; if (extension_loaded ('curl') {$ ch = curl_init (); curl_setopt ($ ch, CURLOPT_URL, $ url); curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt ($ ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($ ch, CURLOPT_HEADER, 0); $ co Ntent = curl_exec ($ ch); curl_close ($ ch);} else {$ content = file_get_contents ($ url);} return trim ($ content );} function s ($ code) {preg_match_all ('/"\'] +) [" | \ ']? \ S * [^>] *> ([^>] +) <\/a>/is ', $ code, $ arr ); return array ('name' => $ arr [2], 'URL' => $ arr [1]);} function get_sub_content ($ str, $ start, $ end) {$ start = trim ($ start); $ end = trim ($ end); if ($ start = ''| $ end = '') {return $ str ;}$ str = explode ($ start, $ str); $ str = explode ($ end, $ str [1]); return $ str [0];} function vd ($ var) {echo"
\ R \ n "; echo"
\r\n"; var_dump($var); echo "\r\n
\ R \ n "; echo"";}}// Convert html to textfunction SpHtml2Text ($ str) {$ str = preg_replace ("/
|
|
/IsU "," ", $ str); $ alltext =" "; $ start = 1; for ($ I = 0; $ I
") {$ Start = 1;} else if ($ start = 1) {if ($ str [$ I] =" <") {$ start = 0; $ alltext. = "";} else if (ord ($ str [$ I])> 31) {$ alltext. = $ str [$ I] ;}}$ alltext = str_replace ("", "", $ alltext); $ alltext = preg_replace ("/& ([^; &] *) (; | &)/"," ", $ alltext); $ alltext = preg_replace ("/[] +/s "," ", $ alltext ); return $ alltext;}?>