douzhao2047 2019-02-27 16:04
浏览 230

用ip和port cURL php请求

I would like to develop a script which, at the submit of a form, send a request to an url using ip adress and port in order to send an sms via the gateway configured on my phone.

The url I have

$url = "192.168.1.31:43382/send.html?smsto=XXXXXXXXXX&smsbody=test&smstype=sms";

And my cURL code :

$ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_VERBOSE, true);
    $verbose = fopen('php://temp', 'w+');
    curl_setopt($ch, CURLOPT_STDERR, $verbose);

    $result = curl_exec($ch);

    curl_close($ch);

It works fine localy until I put it on my server.

When I log verbose's value, I get this :

 Hostname was NOT found in DNS cache
 Trying 192.168.1.31... 
 connect to 192.168.1.31 port 43382 failed: Connection timed out
 Failed to connect to 192.168.1.31 port 43382: Connection timed out
 Closing connection 0

I've seen that it could be a firewall issue, so I disabled it but nothing new.

I'm new to cURL, if someone could guide me...

Thanks

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 运筹学中在线排序的时间在线排序的在线LPT算法
    • ¥30 求一段fortran代码用IVF编译运行的结果
    • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
    • ¥15 lammps拉伸应力应变曲线分析
    • ¥15 C++ 头文件/宏冲突问题解决
    • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
    • ¥50 安卓adb backup备份子用户应用数据失败
    • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
    • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
    • ¥30 python代码,帮调试,帮帮忙吧