Using URL and refer, the content can be parsed on other GET interfaces, but using the following PHP code returns 404
小马
小马 2018-07-09 17:58:41
0
2
1436

Using URL and refer, the content can be parsed on the online PHP GET interface provided by other websites, and the packet can be captured directly on the web page. However, the following PHP code returns 404. Is this header written wrong?


##<?php

$url='http://interface.yy.com/hls/new/get/54880976/54880976/1200? source=wapyy&callback=jsonp2';

$refer='http://wap.yy.com';

$opt=array('http'=>array('header' =>"Referer: $refer"));

$context=stream_context_create($opt);

$html = file_get_contents($url,false, $context);

echo '<br>The following is the parsed content:';

echo '<br>';

echo $html;

?>



小马
小马

reply all(1)
无忌哥哥

404 should be that there is a problem with the parameters in file_get_contents and the relevant page is not obtained

  • reply Solved, we need to add UA to the header, and then add a newline character to each item in the header. I added UA before but didn’t add a newline character. It took me a day.
    小马 author 2018-07-11 21:28:15
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!