我尝试使用 curl 发送一个 http url,但它根本不起作用,这是我使用的代码:
<?php
$username = 'username';
$password = 'password';
$sender='sender';
$msisdn = '+96899999999';
$content="Test MSG";
$data = "username=".$username."&password=".$password."&message=".urlencode($content)."&sender=".$sender."&msisdn=".urlencode($msisdn);
$ch = curl_init('http://bulksms.vsms.net/eapi/submission/send_sms/2/2.0');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS,$data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if ($response = curl_exec($ch))
{
echo "1";
}
else
{
echo "0";
}
curl_close ($ch);
?>
它总是返回 0。可能是什么问题?