无法打开流:连接超时 - PHP

时间:2016-07-26 09:21:39

标签: php url curl file-get-contents

我使用file_get_contents但我收到了错误

  

无法打开流:连接已超时

$url中调用的URL和存储在同一服务器中的php文件。我已经使用过curl。

如何解决这个问题?

PHP代码段:

$context  = stream_context_create($options);
$reply = file_get_contents($url, false, $context);
if(preg_match($reply, 'No information was found') {
    echo("<script>location.href = '/page/message/';</script>");
} else {
    echo $reply;   
    echo '<div>
   For any other questions please contact us Monday - Sunday 9am - 6pm at <strong style="color: #000;">1235456</strong> or <strong style="color: #000;">info@example.com</strong>
    </div>';
}

0 个答案:

没有答案