Html cannot be captured, neither curl nor file_get_contents can be captured, but the page can be opened directly.

Source: Internet
Author: User
Html cannot be captured, neither curl nor file_get_contents can be captured, but the page can be opened directly. Html cannot be captured, neither curl nor file_get_contents can be captured, but the page can be opened directly.

Consult

The URL is as follows:
Https:/count.taobao.com/counter3? Keys = SM_368_dsr-1097280647, iccp_rj522177046867 & callback = jsonp107

Why can't I catch any content? it's always empty.


Reply to discussion (solution)

Paste your code to see

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

Try setting CURLOPT_USERAGENT with the browser ID in curl.

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



How can I get this 4905? Thanks, online, etc. I will close the post immediately.
"Iccp_2017522177046867": 4905

He returns a function called by 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_417522177046867": 4914 });

Extract the content in the parentheses and use the json_decode function to decode them.

He returns a function called by 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_417522177046867": 4914 });

Extract the content in the parentheses and use the json_decode function to decode them.



$ Arr = json_decode ($ response, false );
Var_dump ($ arr );
Result $ arr is Null.

Take it for fun,

  

Update:

   

Dare not give a better name to the title of the question next time. you won't be able to pull the function.

   
   Iccp_487522177046867;?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.