php Connection timed out after 30000 milliseconds
function HttpRequest($url, $params, $method = 'GET', $header = array(), $bEncode = true)
{
$opts = array(
CURLOPT_TIMEOUT => ,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_HTTPHEADER => $header
);
/* 根据请求类型设置特定参数 */
switch (strtoupper($method)) {
case 'GET':
$opts[CURLOPT_URL] = $url;
break;
case 'POST':
$opts[CURLOPT_URL] = $url;
$opts[CURLOPT_POST] = 1;
$opts[CURLOPT_POSTFIELDS] = json_encode($params, JSON_UNESCAPED_UNICODE);
break;
default:
throw new Exception('不支持的请求方式!');
}
/* 初始化并执行curl请求 */
$ch = curl_init();
curl_setopt_array($ch, $opts);
$data = curl_exec($ch);
$error = curl_error($ch);
curl_close($ch);
echo $error;
if ($error) throw new Exception('请求发生错误:' . $error);
return $data;
}
如果某个请求url出现这种问题
只能排除法看出问题
1. 使用你的curl http代码请求别的网站试试
2. 相同的代码在别的电脑上,别的服务器上试试
3. ping 一下你请求的url的host, 多ping ping 基本素养别忘。 试了三个小时最后发现是个原因,根本ping不通
php Connection timed out after 30000 milliseconds的更多相关文章
- Action.c(28): Error -27796: Failed to connect to server "xxxx": [10060] Connection timed out
Error -27796: Failed to connect to server "125.93.51.230:8080": [10061] Connection refused ...
- weedfs getsockopt: connection timed out
启动master weed master -ip 10.191.197.133 -mdir /namenode -ip.bind 10.191.197.133 I0809 16:53:51 7721 ...
- ssh启动报错:org.dom4j.DocumentException: Connection timed out: connect Nested exception: Connection timed out: connect
ssh项目启动报错: org.dom4j.DocumentException: Connection timed out: connect Nested exception: Connection t ...
- rabbitMQ Connection timed out
在VM中部署了一个rabbitMQ server ,在物理机上按照rabbitMQ官网上的 java的教程访问VM中的rabbitMQ报如下错误: Exception in thread " ...
- nginx 报错 upstream timed out (110: Connection timed out)解决方案
nginx 作PHP的web接口服务器. 在线上发现时不时经常崩溃.504,导致接口访问无响应回复. 查看日志: [error] 11618#0: *324911 upstream timed out ...
- 压测 502 日志报错 upstream timed out (110: Connection timed out)
环境介绍 服务器:centos6.5服务:nginx proxy 问题描述: 压测 开发同事 的开发环境项目没事,但是 线上机器 命中%50 ,大量502 php的某些页面打不开,页面提示gatewa ...
- hibernate3.0 org.dom4j.DocumentException: Connection timed out: connect Nested exception:
hibernate3.0 org.dom4j.DocumentException: Connection timed out: connect Nested exception: 所报异常: 严重 ...
- nginx 报错 upstream timed out (110: Connection timed out)解决方案【转】
转自 nginx 报错 upstream timed out (110: Connection timed out)解决方案 - 为程序员服务http://outofmemory.cn/code-sn ...
- 项目的ip地址更改,用git从远程提取代码出现错误,提示为 network error connection timed out
昨天公司的ip进行了修改,在今天从远程提取代码的过程中提示network error connection timed out错误,从网上看了一下解决方法 1:打开项目文件夹,点击查看 2:勾选隐藏的 ...
随机推荐
- Python之读写文本数据
知识点不多 一:普通操作 # rt 模式的 open() 函数读取文本文件 # wt 模式的 open() 函数清除覆盖掉原文件,write新文件 # at 模式的 open() 函数添加write ...
- elasticsearch 基础 —— Update By Query API
Update By Query API 最简单的用法是_update_by_query在不更改源的情况下对索引中的每个文档执行更新.这对于获取新属性或其他一些在线映射更改很有用 .这是API: POS ...
- 【LeetCode】双指针 two_pointers(共47题)
[3]Longest Substring Without Repeating Characters [11]Container With Most Water [15]3Sum (2019年2月26日 ...
- ZYNQ跑系统 系列(二) petalinux方式移植linux
三.搭建petalinux工程 0.定位目录 先在shell中找一个准备存放工程的地方,(我的是home/hlf/PRO),命令行cd home/hlf/PRO 1.定位编译链 根据安装p ...
- procixx地址
\\192.168.35.7\Download\Builds\procixx_psoc
- mongodb 集合操作 (增删改查)
1.插入: 使用insert或save方法想目标集合插入一个文档: db.person.insert({"name":"ryan","age" ...
- linux firewall
一.查看防火墙状态1.首先查看防火墙是否开启,如未开启,需要先开启防火墙并作开机自启 systemctl status firewalld 开启防火墙并设置开机自启 systemctl start f ...
- javascript数组赋值操作的坑
描述:数组对象赋值,即arr1=[{},{},{}]这种数据结构的对象赋值,将arr1赋值给arr2:然后删除arr2里的元素 一.最常用的= arr2 = arr1; detect(val) { l ...
- ubuntu chm文档阅读器
一,chm阅读器名称 KchmViewer 安装方法 sudo apt-get install kchmviewer 使用 kchmviewer #非root用户可以直接使用
- 爬虫技术:scrapy 知识点一
---恢复内容开始--- 1.scrapy框架 每一步的解释: step1:引擎从爬虫器获取要爬行的初始请求. step2:引擎在调度程序中调度请求,引擎把这个初始请求传递给调度器,并向调度器索要下一 ...