【发布时间】:2019-08-09 05:39:38
【问题描述】:
我该如何解决这个问题?我无法在我的工作上发送短信。
$ch = curl_init(); //curl()
$parameters = array(
'apikey' => '8a6bb687750b59d8f099cb489b43c256', //Your API KEY
'number' => '09096817174',//number
'message' => 'I just sent my first message with Semaphore', //message
'sendername' => 'SEMAPHORE');
curl_setopt( $ch, CURLOPT_URL,'https://semaphore.co/api/v4/messages');
curl_setopt( $ch, CURLOPT_POST, 1 );
//Send the parameters set above with the request
curl_setopt( $ch, CURLOPT_POSTFIELDS, http_build_query( $parameters ) );
我该如何解决这个问题?我在信号量中有我的 apikey。
【问题讨论】:
-
根据文档,url应该是:
https://api.semaphore.co/api/v4/messages,你缺少子域部分 -
此代码在信号量中给出。
-
你从返回响应中得到消息 id ?
-
尝试打印响应并检查 $output = curl_exec( $ch ); curl_close ($ch); //显示服务器响应 echo $output;