+
95
-

php curl如何获取http请求头和响应头信息?

php
php curl如何获取http请求头和响应头信息?

网友回复

+
15
-

<?php
$ch = curl_init();

curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //TRUE 将curl_exec()获取的信息以字符串返回,而不是直接输出。

$header = ['User-Agent: bfw.wiki']; //设置一个你的浏览器agent的header
curl_setopt...

点击查看剩余70%

我知道答案,我要回答