Using php to capture batch keywords Baidu advertising websites saved in txt files combined with the server's scheduled tasks, you can regularly find the degree of competition for keyword ads
Php code
] *?>. *? <\/Script>/', "", $ contents);/* Remove js code */$ contents_left = ""; $ contents_right = ""; $ ads_left_green = ""; $ ads_left_white = ""; $ contentsbytwoside = ""; $ ads_right = "";/* Variable initialization */$ contentsbytwoside = explode ('] * Class = \ "EC_im EC_fr EC_PP EC_idea1017 \"> .*?) ', $ Contents_right, $ ads_right); echo "------------ Keywords ads for". $ kw. "start ------------------------------------
"; Fwrite ($ fp," ---------- ". $ kw." ads start ----------------------- \ r \ n "); echo" left ads with green background is
";/* Print_r ($ ads_left_green [0]); */foreach ($ ads_left_green [0] as $ tg1) {preg_match ('/.*? <\/Span>/', $ tg1, $ tg11); fwrite ($ fp, strip_tags ($ tg11 [0]). "\ r \ n"); echo $ tg11 [0]."
";}; Echo"
-------------
"; Echo" left ads with white background is
";/* Print_r ($ ads_left_white [0]); */foreach ($ ads_left_white [0] as $ tg2) {preg_match ('/.*? <\/Span>/', $ tg2, $ tg22); fwrite ($ fp, strip_tags ($ tg22 [0]). "\ r \ n"); echo $ tg22 [0]."
";}; Echo"
-------------
"; Echo" right ads with is
";/* Print_r ($ ads_right [0]); */foreach ($ ads_right [0] as $ tg3) {preg_match ('/(.*? <\/Font>)/', $ tg3, $ tg33); fwrite ($ fp, strip_tags ($ tg33 [0]). "\ r \ n"); echo $ tg33 [0]."
";}; Echo" --------------- Keywords ads for ". $ kw." END ------------------------------------
"; Fwrite ($ fp ,"----------". $ kw. "ads End ------------------------- \ r \ n") ;}; fwrite ($ fp, date ("Y-m-d H: I: s "). "PHP code runs automatically! \ R \ n "); fclose ($ fp); function fetch ($ Date) {$ ch = curl_init (); $ timeout = 5; curl_setopt ($ ch, CURLOPT_URL, "$ Date"); curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) "); curl_setopt ($ ch, CURLOPT_CONNECTTIMEOUT, $ timeout); $ contents = curl_exec ($ ch); curl_close ($ ch); return $ contents;}?>