php7的curl error,PHP CURL Error 7 failed to connect to host

I have a peculiar problem i am facing with Php CURL .

I am trying to call a web service running on a windows machine within the same network via a php script running on a centos workstation. I am using CURL. The problem is that i can access the URL with the browser and it works perfectly. BUt when i try to use the php script it gives an error code 7 .

HOwever if i try a local ip address and google in the php script it works with no issues. What could be the issue? I have been trying to get me head around this issue for the past few hours but i am not able to sort it.

I would also like to add, when i use crl via the terminal i get a proper reply. HTTP 200OK

Help Required :) $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_RETURNTRANSFER => 1, CURLOPT_HEADER => 1, CURLOPT_TIMEOUT => 4, CURLOPT_USERAGENT=>'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13', CURLOPT_VERBOSE => 1, CURLOPT_PORT => 9710, CURLOPT_URL => 'http://192.168.100.4:9710/http/send-message?message='.$message )); // Send the request & save response to $resp $resp = curl_exec($curl); echo "
Error Code : " .curl_errno($curl);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值