【发布时间】:2018-03-30 04:04:13
【问题描述】:
当我想使用 php curl 或 file_get_contents 函数发送 GET 请求时遇到问题!!! 我认为这个问题出在我的 URL 上!!! 请帮我 ... 我的代码(file_get_contents 函数):
$SMStext = "text";
$SMSmobile = 'phonenumber';
$SMSurl = "http://api.payamak-panel.com/post/sendsms.ashx?username=username&password=pass&from=smsnumber&to=";
$SMSurl .= $SMSmobile;
$SMSurl .= '&text=';
$SMSurl .= $SMStext;
echo file_get_contents($SMSurl);
我的代码(php curl):
$SMStext = "text";
$SMSmobile = 'phonenumber';
$SMSurl = "http://api.payamak-panel.com/post/sendsms.ashx?username=username&password=pass&from=smsnumber&to=";
$SMSurl .= $SMSmobile;
$SMSurl .= '&text=';
$SMSurl .= $SMStext;
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$SMSurl);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
// curl_setopt($ch,CURLOPT_HEADER, false);
$output=curl_exec($ch);
curl_close($ch);
echo $output
【问题讨论】:
标签: php curl get-request