如题,彩信接口在外网状态下已经调通,但公司用的是内网,需要走代理服务器才能访问外网,彩信接口是通过curl post到指定地址的。
$url = 'http://122.200.77.96/sendMMS';
$header[] = "Content-type: text/xml";
$ch = curl_init ($url);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlData);
$response = curl_exec($ch);
if(curl_errno($ch)){
print curl_error($ch);
}
curl_close($ch);
这是post到彩信接口的代码,如何通过curl走代理服务器,再post到指定接口
curl_setopt($ch, CURLOPT_PROXY, $this->data['proxy']);
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
用这两个 但是明明没错 我自己本地 也搞不出来 郁闷
curl_setopt($ch, CURLOPT_PROXY, "代理服务器地址:端口");
curl_setopt($ch, CURLOPT_PROXYUSERPWD, "用户名:口令"); //没有就不要这句
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号