标签:
搜狗搜索公众号内的文章,默认是特殊的json格式,无法用于wp_autopost采集,提取了一下。
<?php $url = "http://weixin.sogou.com/gzhjs?cb=sogou.weixin.gzhcb&openid=oIWsFtzSR_4RbC1QpdwrVLTEkxJk&page=1&t=1420517379862"; $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT,100); $dxycontent = curl_exec($ch); //echo $dxycontent; $str = $dxycontent; $kw = "php"; preg_match_all(‘/http:\/\/([.a-zA-Z0-9_&=?\/]*)#rd/‘,$str,$mat); //var_export($mat); //die(); ?> <html> <head>太虚讲堂微信</head> <body> <?php for($i=0;$i<count($mat[0]);$i++){ echo ‘<a href="‘.$mat[0][$i].‘">weixin{$i}</a><br />‘; } // echo $str; ?> </body> </html>
标签:
原文地址:http://my.oschina.net/jianhui1980/blog/364271