{"id":233,"date":"2015-12-24T14:29:57","date_gmt":"2015-12-24T06:29:57","guid":{"rendered":"http:\/\/blog.md5.red\/?p=233"},"modified":"2015-12-24T15:32:29","modified_gmt":"2015-12-24T07:32:29","slug":"%e6%8c%96%e6%9e%81%e5%93%81-%e6%9a%82%e5%81%9c%e6%9b%b4%e6%96%b0%e5%8f%8a%e9%83%a8%e5%88%86%e6%ba%90%e7%a0%81","status":"publish","type":"post","link":"https:\/\/blog.md5.red\/?p=233","title":{"rendered":"\u6316\u6781\u54c1 \u6682\u505c\u66f4\u65b0\u53ca\u90e8\u5206\u6e90\u7801"},"content":{"rendered":"<p><a href=\"http:\/\/blog.md5.red\/wp-content\/uploads\/2015\/12\/wajipin.jpg\" class=\"highslide-image\" onclick=\"return hs.expand(this);\" rel=\"attachment wp-att-235\"><img decoding=\"async\" class=\"alignnone size-full wp-image-235\" src=\"http:\/\/blog.md5.red\/wp-content\/uploads\/2015\/12\/wajipin.jpg\" alt=\"wajipin\" width=\"1109\" height=\"307\" srcset=\"https:\/\/blog.md5.red\/wp-content\/uploads\/2015\/12\/wajipin.jpg 1109w, https:\/\/blog.md5.red\/wp-content\/uploads\/2015\/12\/wajipin-300x83.jpg 300w, https:\/\/blog.md5.red\/wp-content\/uploads\/2015\/12\/wajipin-768x213.jpg 768w, https:\/\/blog.md5.red\/wp-content\/uploads\/2015\/12\/wajipin-1024x283.jpg 1024w\" sizes=\"(max-width: 1109px) 100vw, 1109px\" \/><\/a><\/p>\n<p>\u6682\u505c\u66f4\u65b0\u4e3b\u8981\u662f\u56e0\u4e3a\u6dd8\u5b9d\u5bf9\u722c\u53d6\u4fe1\u606f\u5361\u5f97\u592a\u6b7b\u4e86\uff0c\u670d\u52a1\u5668IP\u603b\u662f\u88ab\u5c01\uff0c\u5bfc\u81f4\u7ecf\u5e38\u6293\u53d6\u5931\u8d25\uff0cOpen API\u53c8\u7533\u8bf7\u4e0d\u5230\uff0c\u65e0\u5948\uff0c\u6682\u505c\u66f4\u65b0\uff0c\u5f53\u5e74\u4fee\u6539\u4e3b\u9898\u548c\u5f00\u53d1\u7f51\u7ad9\u4e5f\u82b1\u4e86\u4e0d\u5c11\u65f6\u95f4\u7814\u7a76\uff0c\u53d1\u70b9\u6e90\u7801\u4e2d\u7684\u51fd\u6570\u51fa\u6765\uff0c\u8bf4\u4e0d\u5b9a\u53ef\u4ee5\u5e2e\u52a9\u4e00\u4e9b\u4eba\u3002<\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n<p>require('Snoopy.class.php');<br \/>\nfunction snoopyGET($url){<br \/>\n$snoopy = new Snoopy;<br \/>\n$snoopy-&gt;agent = \"(Mozilla\/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727))\"; \/\/\u4f2a\u88c5\u6d4f\u89c8\u5668<br \/>\n$snoopy-&gt;referer = \"http:\/\/www.9it.me\"; \/\/\u4f2a\u88c5\u6765\u6e90\u9875\u5730\u5740 http_referer<br \/>\n$snoopy-&gt;rawheaders[\"Pragma\"] = \"no-cache\"; \/\/cache \u7684http\u5934\u4fe1\u606f<br \/>\n\/\/ $snoopy-&gt;rawheaders[\"X_FORWARDED_FOR\"] = \"8.8.8.101\"; \/\/\u4f2a\u88c5ip<br \/>\n$snoopy-&gt;fetch($url); \/\/\u83b7\u53d6\u6240\u6709\u5185\u5bb9<br \/>\nreturn $snoopy-&gt;results; \/\/\u663e\u793a\u7ed3\u679c<br \/>\n}<\/p>\n<p>function getshopitems($theid,$userid){ \/\/\u5229\u7528\u5356\u5bb6userid\u83b7\u53d6\u5e97\u5185\u5546\u54c1\u4fe1\u606f<br \/>\n$getitemsurl='https:\/\/s.taobao.com\/search?inshopn=8&amp;inshops=2&amp;userids='.$userid.'&amp;app=api&amp;m=get_shop_auctions';<br \/>\n\/\/echo $getitemsurl;<br \/>\n\/\/ $items=snoopyGET(\"$getitemsurl\");\/\/\u5e97\u5185\u5546\u54c1\u4fe1\u606fjson<br \/>\n\/\/$items=web_http($getitemsurl,'https',);\/\/\u5e97\u5185\u5546\u54c1\u4fe1\u606fjson<br \/>\n$items=file_get_contents(\"$getitemsurl\");<br \/>\nif($items==\"\")<br \/>\n{<br \/>\n$updatelock=0;\/\/\u89e3\u9664\u5237\u65b0\u9501\u5b9a<br \/>\nupdate_option( $option_name, $updatelock );<br \/>\nreturn 0;<br \/>\n}<br \/>\n$itemsUTF8=iconv('GBK', 'UTF-8\/\/IGNORE', $items);<br \/>\n$itemsUTF8 = str_replace('jsonp_reviews_list(','',$itemsUTF8);\/\/\u53bb\u6389\u591a\u4f59\u7684\u5b57\u7b26\u4e32<br \/>\n$itemsUTF8 = str_replace(')','',$itemsUTF8);<br \/>\n$itemsdata = json_decode($itemsUTF8,TRUE);\/\/\u5f97\u5230\u6570\u636e\u4e86\uff0c\u7b2c\u4e8c\u4e2a\u53c2\u6570\u662f\u8f6c\u5316\u4e3a\u6570\u7ec4<br \/>\nadd_post_meta($theid, itemsdata, $itemsdata, true) or update_post_meta($theid, itemsdata, $itemsdata);<br \/>\n}<\/p>\n<p>function trimall($str)\/\/\u5220\u9664\u7a7a\u683c<br \/>\n{<br \/>\n$qian=array(\" \",\"\u3000\",\"\\t\",\"\\n\",\"\\r\");$hou=array(\"\",\"\",\"\",\"\",\"\");<br \/>\nreturn str_replace($qian,$hou,$str);<br \/>\n}<\/p>\n<p>function cut($file,$from,$end,$num=1){<br \/>\n$message=explode($from,$file);<br \/>\n$message=explode($end,$message[$num]);<br \/>\nreturn $message[0];<br \/>\n}<\/p>\n<p>function updateshopinfoALL($theid,$shopURL){<br \/>\n\/\/\u5728\u6570\u636e\u5e93\u4e2d\u6dfb\u52a0\u9501\u5b9a\uff0c\u9632\u6b62\u6709\u4eba\u540c\u65f6\u5237\u65b0\u9875\u9762<br \/>\n$option_name='updatelock';<br \/>\nif(get_option($option_name)==1)return false;\/\/\u5224\u65ad\u4e0b\uff0c\u5982\u679c\u662f\u9501\u5b9a\u72b6\u6001\uff0c\u5c31\u4e0d\u5237\u65b0\uff0c\u4e5f\u4e0d\u66f4\u65b0\u65f6\u95f4<br \/>\n$updatelock=1;\/\/\u5f00\u59cb\u9501\u5b9a\u7136\u540e\u5237\u65b0\u64cd\u4f5c<br \/>\nupdate_option( $option_name, $updatelock );<br \/>\n$time=time();<br \/>\nif($time!=\"\")add_post_meta($theid, updatetime, $time, true) or update_post_meta($theid, updatetime, $time);\/\/\u7b2c\u4e00\u65f6\u95f4\u628atime\u66f4\u65b0\uff0c\u9632\u6b62\u91cd\u590d\u5237\u65b0\u5bfc\u81f4\u88ab\u5c01<br \/>\n\/\/\u5fc5\u987b\u8981\u6253\u5f00\u5e97\u94fa\u4e00\u6b21\uff0c\u5426\u5219\u4e0d\u77e5\u9053\u5e97\u94fa\u662f\u5426\u5f02\u5e38\uff0c\u7528\u641c\u7d22\u65e0\u6cd5\u5b9e\u73b0<\/p>\n<p>\/\/ $ShopContent=snoopyGET(\"$shopURL\");<br \/>\nif(strcmp(substr($shopURL,0,5),\"https\")!=0)$shopURL=\"https:\/\/\".substr($shopURL,7);\/\/\u5982\u679c\u4e0d\u662fhttps\u7684\u81ea\u52a8\u6539\u4e3ahttps<br \/>\n$ShopContent=file_get_contents(\"$shopURL\");<br \/>\nif($ShopContent==\"\")<br \/>\n{<br \/>\n$updatelock=0;\/\/\u89e3\u9664\u5237\u65b0\u9501\u5b9a<br \/>\nupdate_option( $option_name, $updatelock );<br \/>\nreturn 0;<br \/>\n}<br \/>\n$num=1;<br \/>\nif(strpos($ShopContent,iconv('UTF-8', 'GBK', '\u63cf\u8ff0\u76f8\u7b26'))&gt;0)add_post_meta($theid, shopclose, $num , true) or update_post_meta($theid, shopclose, $num);<br \/>\nif(strpos($ShopContent,iconv('UTF-8', 'GBK', '\u63cf\u8ff0\u76f8\u7b26'))==false){<br \/>\n$shopclose = get_post_meta($theid, shopclose, true);<br \/>\n$shopclose=$shopclose+1; \/\/\u5982\u679c\u6ca1\u6709\u83b7\u53d6\u5230\u5c31\u8ba4\u4e3a\u5b58\u5728\u5f02\u5e38\uff0c\u7ec8\u6b62\u64cd\u4f5c<br \/>\nadd_post_meta($theid, shopclose, $shopclose, true) or update_post_meta($theid, shopclose, $shopclose);<br \/>\n$updatelock=0;\/\/\u89e3\u9664\u5237\u65b0\u9501\u5b9a<br \/>\nupdate_option( $option_name, $updatelock );<br \/>\nreturn false;<br \/>\n}<br \/>\n$userid=cut($ShopContent,\"userId=\", \"\\\"\/\",1); \/\/\u672a\u52a0\u5bc6\u7684\u5356\u5bb6\u7528\u6237ID<br \/>\n$uidjiami=cut($ShopContent,\"rate.taobao.com\/user-rate-\", \".htm\",1);<br \/>\n$rateURL=\"https:\/\/rate.taobao.com\/user-rate-\".$uidjiami.'.htm';<br \/>\nusleep(500000); \/\/\u5ef6\u65f60.5\u79d2<br \/>\nif($userid!=\"\")getshopitems($theid,$userid); \/\/\u83b7\u53d6\u5356\u5bb6\u5e97\u5185\u5546\u54c1\u4fe1\u606f\u8f6c\u6362\u4e3a\u6570\u7ec4\u540e\u52a0\u5165\u6570\u636e\u5e93<br \/>\nusleep(500000); \/\/\u5ef6\u65f60.5\u79d2<br \/>\n\/\/ $RateContent=snoopyGET(\"$rateURL\");\/\/\u83b7\u53d6\u8bc4\u4ef7\u9875\u9762<br \/>\n\/\/$RateContent=web_http($rateURL,'https','');\/\/\u83b7\u53d6\u8bc4\u4ef7\u9875\u9762<br \/>\n$RateContent=file_get_contents(\"$rateURL\");<br \/>\nif($RateContent==\"\")<br \/>\n{<br \/>\n$updatelock=0;\/\/\u89e3\u9664\u5237\u65b0\u9501\u5b9a<br \/>\nupdate_option( $option_name, $updatelock );<br \/>\nreturn 0;<br \/>\n}<br \/>\n$RateContentUTF8=iconv('GBK', 'UTF-8\/\/IGNORE', $RateContent);\/\/\u6dd8\u5b9d\u662fGBK\u7f16\u7801\u7684\u8981\u8f6c\u6362\u6210UTF8<br \/>\n$RateContent=TrimAll($RateContentUTF8,1,3);\/\/\u53bb\u9664\u6240\u6709\u7a7a\u683c<br \/>\n$haopinglv=@cut($RateContent,\"&lt;emstyle=\\\"color:gray;\\\"&gt;\u597d\u8bc4\u7387\uff1a\", \"&lt;\/em&gt;&lt;\/h4&gt;\",1);<br \/>\n$zhuying=cut($RateContent,\".htm\\\"target=\\\"_blank\\\"&gt;&amp;nbsp;\", \"&lt;\/a&gt;\",1);<br \/>\n$shopStartDate=cut($RateContent,\"name=\\\"shopStartDate\\\"id=\\\"J_showShopStartDate\\\"value=\\\"\", \"\\\"\/&gt;\",1);<br \/>\n$baozhengjin=cut($RateContent,\"\u5356\u5bb6\u5f53\u524d\u4fdd\u8bc1\u91d1\u4f59\u989d&lt;span&gt;\uffe5\", \"&lt;\/span&gt;\",1);<br \/>\n$wangwang=cut($RateContent,\"tbrate.2.1\\\"data-nick=\\\"\", \"\\\"data-tnick\",1);<br \/>\n$wangwangGBK=iconv('UTF-8', 'GBK', $wangwang);<br \/>\n$searchURL=\"https:\/\/s.taobao.com\/search?app=shopsearch&amp;rele_field=wangwang&amp;q=\".$wangwangGBK;<br \/>\nusleep(500000); \/\/\u5ef6\u65f60.5\u79d2<br \/>\n\/\/ $searchContent=snoopyGET(\"$searchURL\");<br \/>\n$searchContent=file_get_contents(\"$searchURL\");<\/p>\n<p>$searchContentUTF8=iconv('GBK', 'UTF-8\/\/IGNORE', $searchContent);\/\/\u6dd8\u5b9d\u662fGBK\u7f16\u7801\u7684\u8981\u8f6c\u6362\u6210UTF8<br \/>\n$searchContent=TrimAll($searchContentUTF8,1,3);\/\/\u53bb\u9664\u6240\u6709\u7a7a\u683c<br \/>\n$shopPIC=cut($searchContent,\"target=\\\"_blank\\\"&gt;&lt;imgsrc=\\\"\/\/\", \"_70x70.jpg\",1); \/\/shopPIC\u96c6\u5e02\u548c\u5929\u732b\u662f\u4e00\u6837\u7684<br \/>\n$miaoshu=cut($searchContent,\"mas\\\":\\\"\", \"\\\",\\\"\",1); \/\/\u4ece\u5e97\u94fa\u641c\u7d22\u627e\u5230\u63cf\u8ff0\u76f8\u7b26\u5206\u6570<br \/>\n$miaoshubijiao=cut($searchContent,\"mg\\\":\\\"\", \"%\\\",\\\"\",1);<br \/>\n$fuwu=cut($searchContent,\"sas\\\":\\\"\", \"\\\",\\\"\",1);<br \/>\n$fuwubijiao=cut($searchContent,\"sg\\\":\\\"\", \"%\\\",\\\"\",1);<br \/>\n$wuliu=cut($searchContent,\"cas\\\":\\\"\", \"\\\",\\\"\",1);<br \/>\n$wuliubijiao=cut($searchContent,\"cg\\\":\\\"\", \"%\\\",\\\"\",1);<br \/>\nif($haopinglv==\"\") \/\/\u5929\u732b<br \/>\n{<br \/>\n$leixing=\"\u5929\u732b\u5546\u57ce\";\/\/\u5929\u732b<br \/>\n}<br \/>\nelse \/\/\u6dd8\u5b9d\u96c6\u5e02<br \/>\n{<br \/>\n$leixing=\"\u6dd8\u5b9d\u96c6\u5e02\";\/\/\u96c6\u5e02<br \/>\n$sellerxinyong=cut($RateContent,\"&lt;li&gt;\u5356\u5bb6\u4fe1\u7528\uff1a\", \"&lt;ahref=\\\"\/\/\",1);<br \/>\n$buyerxinyong=cut($RateContent,\"&lt;li&gt;\u4e70\u5bb6\u4fe1\u7528\uff1a\", \"&lt;\",1);<br \/>\n$sellerPic=cut($RateContent,\"153-156-164\/help-842.htm\\\"target=\\\"_blank\\\"&gt;&lt;imgsrc=\\\"\/\/\", \"\\\"border=\",1);<br \/>\n}<br \/>\nif($wangwang!=\"\") add_post_meta($theid, wangwang, $wangwang, true) or update_post_meta($theid, wangwang, $wangwang);<br \/>\nif($rateURL!=\"\") add_post_meta($theid, rateURL, $rateURL, true) or update_post_meta($theid, rateURL, $rateURL);<br \/>\nif($shopStartDate!=\"\") add_post_meta($theid, shopStartDate, $shopStartDate, true) or update_post_meta($theid, shopStartDate, $shopStartDate);<br \/>\nif($leixing!=\"\")add_post_meta($theid, leixing, $leixing, true) or update_post_meta($theid, leixing, $leixing);<br \/>\nif($sellerxinyong!=\"\")add_post_meta($theid, sellerxinyong, $sellerxinyong, true) or update_post_meta($theid, sellerxinyong, $sellerxinyong);<br \/>\nif($sellerPic!=\"\")add_post_meta($theid, sellerPic, $sellerPic, true) or update_post_meta($theid, sellerPic, $sellerPic);<br \/>\nif($haopinglv!=\"\")add_post_meta($theid, haopinglv, $haopinglv, true) or update_post_meta($theid, haopinglv, $haopinglv);<br \/>\nif($miaoshu!=\"\")add_post_meta($theid, miaoshu, $miaoshu, true) or update_post_meta($theid, miaoshu, $miaoshu);<br \/>\nif($miaoshubijiao!=\"\")add_post_meta($theid, miaoshubijiao, $miaoshubijiao, true) or update_post_meta($theid, miaoshubijiao, $miaoshubijiao);<br \/>\nif($fuwu!=\"\")add_post_meta($theid, fuwu, $fuwu, true) or update_post_meta($theid, fuwu, $fuwu);<br \/>\nif($fuwubijiao!=\"\")add_post_meta($theid, fuwubijiao, $fuwubijiao, true) or update_post_meta($theid, fuwubijiao, $fuwubijiao);<br \/>\nif($wuliu!=\"\")add_post_meta($theid, wuliu, $wuliu, true) or update_post_meta($theid, wuliu, $wuliu);<br \/>\nif($wuliubijiao!=\"\")add_post_meta($theid, wuliubijiao, $wuliubijiao, true) or update_post_meta($theid, wuliubijiao, $wuliubijiao);<br \/>\nif($shopPIC!=\"\")add_post_meta($theid, shopPIC, $shopPIC, true) or update_post_meta($theid, shopPIC, $shopPIC);<br \/>\nif($zhuying!=\"\")add_post_meta($theid, zhuying, $zhuying, true) or update_post_meta($theid, zhuying, $zhuying);<br \/>\nif($baozhengjin!=\"\")add_post_meta($theid, baozhengjin, $baozhengjin, true) or update_post_meta($theid, baozhengjin, $baozhengjin);<br \/>\n$updatelock=0;\/\/\u89e3\u9664\u5237\u65b0\u9501\u5b9a<br \/>\nupdate_option( $option_name, $updatelock );<br \/>\n}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6682\u505c\u66f4\u65b0\u4e3b\u8981\u662f\u56e0\u4e3a\u6dd8\u5b9d\u5bf9\u722c\u53d6\u4fe1\u606f\u5361\u5f97\u592a\u6b7b\u4e86\uff0c\u670d\u52a1\u5668IP\u603b\u662f\u88ab\u5c01\uff0c\u5bfc\u81f4\u7ecf\u5e38\u6293\u53d6\u5931\u8d25\uff0cOpen API\u53c8\u7533\u8bf7\u4e0d\u5230\uff0c ...<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[9],"class_list":["post-233","post","type-post","status-publish","format-standard","hentry","category-19","tag-9"],"_links":{"self":[{"href":"https:\/\/blog.md5.red\/index.php?rest_route=\/wp\/v2\/posts\/233","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.md5.red\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.md5.red\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.md5.red\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.md5.red\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=233"}],"version-history":[{"count":5,"href":"https:\/\/blog.md5.red\/index.php?rest_route=\/wp\/v2\/posts\/233\/revisions"}],"predecessor-version":[{"id":243,"href":"https:\/\/blog.md5.red\/index.php?rest_route=\/wp\/v2\/posts\/233\/revisions\/243"}],"wp:attachment":[{"href":"https:\/\/blog.md5.red\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=233"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.md5.red\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=233"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.md5.red\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}