HTTP请求失败! HTTP/1.1 503服务暂时不可用 [英] HTTP request failed! HTTP/1.1 503 Service Temporarily Unavailable

查看:232
本文介绍了HTTP请求失败! HTTP/1.1 503服务暂时不可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用file_get_contents函数从网页获取内容. 一些网站运行良好,但大多数网站都给我这个错误

I am using function file_get_contents to get contents from web page. Some website working well but most of them give me this error

failed to open stream: HTTP request failed! HTTP/1.1 503 Service Temporarily Unavailable

这是我的简单代码

echo file_get_contents("url");

当我在浏览器中运行此url时,它工作正常.什么是问题所在?

When i run this url in browser it works fine.what can be the issue?

推荐答案

503表示功能正在运行,并且您正在从远程服务器获得拒绝您的响应.如果您曾经尝试使用cURL来搜索google结果,那么会发生同样的事情,因为它们可以检测到file_get_contents和cURL使用的用户代理,从而阻止了这些用户代理.您从中访问的服务器也有可能将其IP地址列入黑名单,以进行此类操作.

503 means the functions are working and you're getting a response from the remote server denying you. If you ever tried to cURL google results the same thing happens, because they can detect the user-agent used by file_get_contents and cURL and as a result block those user agents. It's also possible that the server you're accessing from also has it's IP address blackballed for such practices.

在远程情况下,命令不能像浏览器一样工作的三个常见原因.

Mainly three common reasons why the commands wouldn't work just like the browser in a remote situation.

1) The default USER-AGENT has been blocked.
2) Your server's IP block has been blocked.
3) Remote host has a proxy detection. 

这篇关于HTTP请求失败! HTTP/1.1 503服务暂时不可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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