我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

为xml fopen设置PHP超时

While accessing xml file with fopen that don’t exist we get

failed to open stream: HTTP request failed!

But it takes 30 seconds. How to return this error immediately or short after not finding a file.

Also, why when file is not found Apache scans lots of ports?

I think this is the way, You have to use fopen itself to check whether it exists or not,

function fileExists($path){
     return (@fopen($path,"r")==true);
}

if(fileExists('http://example.com/test/file.xml'))
{ 
    echo "exists";
}
else
{
    echo "not_exist";
}

近期文章

  • Facebook Graph API - 页面 - 预定的帖子没有回到可促销的帖子中
  • 我已经用php mysqli集成实现了fullcalendar,但是无法获取页面来呈现存储在数据库中的事件
  • 回显PHP数组不返回结果
  • 如何将C库公开给RESTful Web服务
  • 获取count变量中的最后一项
  • 使用ajax上传图像会在JSON数据之后提供非空白字符?
  • php到twitter api 1.1request url
  • 更新Doctrine2中的关联实体
  • 如何用php获取XML的标记名?
  • PHP Undefined Offset除非打印出来
  • 使用Preg_Match在PHP中刮取Javascript
  • mysql查询在数组结果中形成特定的数组
  • Gmail中的响应式邮件程序
  • 最相关的墙帖算法
  • Foreach在一段时间内循环
  • too long
  • PHP / MySQL SELECT查询和按字段排序(value1,value2)等
  • 从另一个选项卡输入表单
  • 将Zend_Form_Element_Text设置为不需要?
  • 在php中的正则表达式与负面的lookbehind

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华