dongtongjian3127 2017-08-04 12:37
浏览 22

使用PHP发送短信

I have developed a system which will send SMS to the customer after making insert to the database but the system which I worked on is public ie. when my client asked me to buy the system he must insert his SMS API configuration to send a message to his customers when I searched on the internet I found that every API have a differnt way to send SMS message I have account in click tell API but when I send message by curl there is nothing happen the code is

$url = 'https://platform.clickatell.com/messages/http/send?' . http_build_query(
    [
      'apiKey' =>  'oGjnzDdSRhqdhhgnjFj3ZmzYA==',
   //   'api_secret' => '4c98619ffb9af51585',
      'to' => '94233698311783',

      'content' => 'Hello from Netcom'
    ]
);
echo($url);echo('<br/>');
echo'https://platform.clickatell.com/messages/http/send?apiKey=oGkmzDdSRgekvjFjaZnzYA==&to=905373545631&content=Test+message+text"';
$ch = curl_init($url);
echo($ch);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);

echo $response;

Where my code is wrong and what is the way to send SMS dynamically depending on the client's API info

  • 写回答

2条回答 默认 最新

  • dongzou3751 2017-08-04 12:44
    关注

    For quick fix and testing add this in your curl request and check response.(Because url is https)

    curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false);

    But it is recomonded to downloading a CA root certificate bundle at the curl website and saving it on your server which protect your site

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度