PHP:file_get_contents返回错误的数据

时间:2018-11-06 09:50:29

标签: php file-get-contents

我使用以下代码:

$contextOption = array( "ssl" => array( "verify_peer" => false,
                                        "verify_peer_name" => false,
                                        "allow_self_signed" => true),
                        "http" => array("method" => "GET",
                                        "header" => "Accept-language: en\r\n"."Cookie: foo=bar\r\n"."User-Agent: Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.102011-10-16 20:23:10\r\n"));

echo $data = file_get_contents('https://www.---.com/', false, stream_context_create($contextOption));

如果我通过浏览器转到https://www.---.com/,则会看到以下数据:

  

a b c d

如果我得到https://www.---.com/的{​​{1}}数据,我得到的数据如下:

  

x z a b c d p

如何?

0 个答案:

没有答案
相关问题