这是什么debug-verbose-info是什么意思? [英] what does this debug-verbose-info mean?
本文介绍了这是什么debug-verbose-info是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试通过cURL + PHP获取页面的内容,但它给我没有回来。当我用 google.com
替换网址时,它可以正常工作。
请求的网页受htaccess- >
这是我的PHP代码
$ login ='admin';
$ password ='xxxxx';
$ ch = curl_init();
curl_setopt($ ch,CURLOPT_URL,$ _REQUEST ['url']);
curl_setopt($ ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ ch,CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($ ch,CURLOPT_SSL_VERIFYHOST,false);
curl_setopt($ ch,CURLOPT_VERBOSE,true);
$ verbose = fopen('bla.txt','w +');
curl_setopt($ ch,CURLOPT_STDERR,$ verbose);
curl_setopt($ ch,CURLOPT_HTTPAUTH,CURLAUTH_BASIC);
curl_setopt($ ch,CURLOPT_USERPWD,$ login:$ password);
$ output = curl_exec($ ch);
curl_close($ ch);
echo $ output;
这是详细信息:
*在DNS缓存中找不到主机名
*尝试xxx.xxx.xxx.xxx ...
*连接到xxxxxxxxx(xxx.xxx.xxx.xxx )端口80(#0)
*使用用户'admin'的Basic进行服务器认证
> GET /mypage.php HTTP / 1.1
授权:基本YWRtaW46cXdlcnR6dTE =
主机:xxxxxxxxxxxxxx.de
接受:* / *
< HTTP / 1.1 301永久移动
<日期:Fri,16 Sep 2016 13:44:28 GMT
*服务器Apache未列入黑名单
<服务器:Apache
< X-Powered-By:PHP / 5.4.45
<到期日:Thu,19 Nov 1981 08:52:00 GMT
< Cache-Control:no-store,no-cache,must-revalidate,post-check = 0,pre-check = 0
& Pragma:no-cache
< Set-Cookie:PHPSESSID = 23cd31457358a63a1b32b86992e906bf2; path = /; HttpOnly
<位置:xxxxxxxxxxxxxxxxxxxxxxx
< Content-Length:0
<连接:close
< Content-Type:text / html; charset = UTF-8
<
*关闭连接0
有人可以告诉我什么是错误?
解决方案
尝试添加 CURLOPT_FOLLOWLOCATION
,并阅读更多关于 CURLOPT_FOLLOWLOCATION
和safe_mode: http://stackoverflow.com/a/21234822/6797531
I try to get the content of a page via cURL+PHP, but it gives me nothing back. When I replace the URL with google.com
it works.
the requested page is htaccess-protected
this is my PHP-Code
$login = 'admin';
$password = 'xxxxx';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $_REQUEST['url']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_VERBOSE, true);
$verbose = fopen('bla.txt', 'w+');
curl_setopt($ch, CURLOPT_STDERR, $verbose);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "$login:$password");
$output = curl_exec($ch);
curl_close($ch);
echo $output;
this is the verbose-info:
* Hostname was NOT found in DNS cache
* Trying xxx.xxx.xxx.xxx...
* Connected to xxxxxxxxx (xxx.xxx.xxx.xxx) port 80 (#0)
* Server auth using Basic with user 'admin'
> GET /mypage.php HTTP/1.1
Authorization: Basic YWRtaW46cXdlcnR6dTE=
Host: xxxxxxxxxxxxxx.de
Accept: */*
< HTTP/1.1 301 Moved Permanently
< Date: Fri, 16 Sep 2016 13:44:28 GMT
* Server Apache is not blacklisted
< Server: Apache
< X-Powered-By: PHP/5.4.45
< Expires: Thu, 19 Nov 1981 08:52:00 GMT
< Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
< Pragma: no-cache
< Set-Cookie: PHPSESSID=23cd31457358a63a1b32b86992e906bf2; path=/; HttpOnly
< Location: xxxxxxxxxxxxxxxxxxxxxxx
< Content-Length: 0
< Connection: close
< Content-Type: text/html; charset=UTF-8
<
* Closing connection 0
can someone tell me what is wrong??
解决方案
try to add CURLOPT_FOLLOWLOCATION
and read more about CURLOPT_FOLLOWLOCATION
and safe_mode: http://stackoverflow.com/a/21234822/6797531
这篇关于这是什么debug-verbose-info是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文