Home  >  Article  >  Backend Development  >  抓取不到html,curl跟file_get_contents都抓不到,但是页面可以直接打开

抓取不到html,curl跟file_get_contents都抓不到,但是页面可以直接打开

WBOY
WBOYOriginal
2016-06-13 12:26:581296browse

抓取不到html,curl和file_get_contents都抓不到,但是页面可以直接打开。
抓取不到html,curl和file_get_contents都抓不到,但是页面可以直接打开。

请教

网址如下
https:/count.taobao.com/counter3?keys=SM_368_dsr-1097280647,ICCP_1_522177046867&callback=jsonp107

为什么我怎么都抓不到内容呢,始终是空
------解决思路----------------------

<br />$ch = curl_init();<br />$url='https://count.taobao.com/counter3?keys=SM_368_dsr-1097280647,ICCP_1_522177046867&callback=jsonp107';<br />curl_setopt($ch, CURLOPT_URL, $url);<br />curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);<br />curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);   <br />curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0);<br />curl_setopt($ch, CURLOPT_HEADER, 0);<br />$output = curl_exec($ch);<br />curl_close($ch);<br />echo  $output;<br />

------解决思路----------------------
拿去玩吧,
<?php<br />//$jsonp=file_get_contents('https://count.taobao.com/counter3?keys=SM_368_dsr-1097280647,ICCP_1_522177046867&callback=jsonp107');<br /><br />$jsonp='jsonp107({"SM_368_dsr-1097280647":{v:0,nv:100,m_UFB:0,m:4.89661,m_g:20.15,s_UFB:0,s:4.8744,s_g:31.49,c_UFB:0,c:4.87867,c_g:39.55,gp:100.00,ss:290159,hdr:true},"ICCP_1_522177046867":4915});';<br /><br />preg_match_all('/\d{1,}}/',$jsonp,$arr);<br />echo trim($arr[0][0],'}');

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn