file_get_contents捕获403禁止错误

发布于 2025-02-02 22:11:21 字数 230 浏览 2 评论 0原文

我有一个PHP文件,该文件通过代理服务器发出file_get_contents请求。有时,由于代理,我会得到403禁止错误响应,并且要用不同的代理重试相同的请求,它只是跳过下一个请求,因此丢失了数据。

我知道,有了卷曲,有一种方法可以捕获错误,如果禁止其403,请与另一个代理人重试,但是如果可以使用file_get_contents,我找不到任何地方。

非常感谢您花时间阅读我的问题,我真的很感谢您的帮助, 真挚地,

I have a php file that makes a file_get_contents request through proxy servers. Sometimes, I get a 403 forbidden error response because of the proxy, and in stead of retrying the same request with a different proxy, it just skips to the next request so the data is lost.

I know that with curl there is a way to catch the error and if its a 403 forbidden, retry with another proxy but I can't find anywhere if this is possible with file_get_contents.

Thanks a lot for taking your time to read my problem and I would really appreciate your help,
Sincerely,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文