Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/287.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用文件获取内容下载url内容_Php_File Get Contents - Fatal编程技术网

Php 使用文件获取内容下载url内容

Php 使用文件获取内容下载url内容,php,file-get-contents,Php,File Get Contents,我试图从我客户的网站上获取内容,并在经过一些处理后将其上传到我的网站上 我试图在PHP环境中使用file_get_contents来获取内容 如果我使用: file_get_contents("http://www.maideden.com/index.php?route=product/product&path=59&product_id=96") 我能得到所有的内容 但是,如果我使用一个变量来存储地址 $url = "http://www.maideden.com/inde

我试图从我客户的网站上获取内容,并在经过一些处理后将其上传到我的网站上

我试图在PHP环境中使用file_get_contents来获取内容

如果我使用:

file_get_contents("http://www.maideden.com/index.php?route=product/product&path=59&product_id=96")
我能得到所有的内容

但是,如果我使用一个变量来存储地址

$url = "http://www.maideden.com/index.php?route=product/product&path=59&product_id=96"
并使用
文件获取内容($url)它没有返回任何内容


有人能帮我吗?我更喜欢使用
file\u get\u contents($url)

这两个示例没有理由表现出任何不同。很可能您遗漏了某个分号(如第二个示例的末尾),这就是导致错误的原因。您是否尝试过
var\u dump(file\u get\u contents($url))
查看它返回的内容?readfile($url)如何配置可能不同?似乎allow_url_fopen必须为true才能使其工作()。或者,查看curl*函数?据我所知,您可能已经关闭了错误,但缺少
$url=…
之后未返回任何内容。http状态代码是什么?是500吗?