file_get_contents()没有回报? [英] no return for file_get_contents()?

查看:104
本文介绍了file_get_contents()没有回报?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么我没有得到file_get_contents($ myurl)的回报,但是我却得到了wget的输出

why i not getting return on file_get_contents($myurl) but i do get output for wget

已更新:

我使用curl获取返回标头和结果,并发现它在标头中而不是主体中

i use curl to get the return header and result and discovery that the it is on the header instead in of the body

HTTP/1.1 200 Document follows
Transfer-Encoding: chunked
Content-type: text/plain
Server: XMS (724Solutions HTA XSAM_30_M2_B020 20070803.172831)
Date: Fri, 21 May 2010 10:48:31 GMT
Accept-Ranges: bytes

HTTP/1.1 404 ChargedPartyNotAvailable
Transfer-Encoding: chunked
Content-type: text/plain
Server: XMS (724Solutions HTA XSAM_30_M2_B020 20070803.172831)
Date: Fri, 21 May 2010 10:34:13 GMT
Accept-Ranges: bytes

如何仅提取"200 Document Follow"和"404 ChargedPartyNotAvailable"?

How can i extract out only "200 Document Follow" and "404 ChargedPartyNotAvailable" ?

推荐答案

您是否具有

Do you have allow_url_fopen enabled in your php configuration?

但是,我希望您会收到一条警告,如果未生成-您是否显示了错误/警告?您可以在脚本顶部临时添加:

However I would expect that you would get a warning generated if not - do you have errors/warnings displayed? You could add temporarily at the top of your script :

error_reporting(E_ALL);
ini_set('display_errors', true);

然后您可能会看到为什么file_get_contents()无法正常工作的原因.

and then you might see why file_get_contents() doesn't work.

修改

如果您仅对标头感兴趣,您也许可以使用 get_headers() .

You might just be able to use get_headers() if you're only interested in headers.

这篇关于file_get_contents()没有回报?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆