php调http接口,2步教你解决http协议php接口调用
生活随笔
收集整理的這篇文章主要介紹了
php调http接口,2步教你解决http协议php接口调用
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
http協(xié)議php短信接口調(diào)用代碼示例:
1.提交方式與編碼
http請求都應(yīng)以POST形式提交,編碼為UTF-8
2.部分核心代碼示例如下final?public?static?function?sendSms($user,$password,$content,$mobiles){
$client?=?new?HttpClient(self::HOST);
$client->setDebug(true);
if(!?$client->post('/sdk/send'?,?array(
'accName'?=>?$user,
'accPwd'?=>?strtoupper(md5($password)),
'content'?=>?mb_convert+encoding($content,'UTF-8',UTF-8),
'aimcodes'?=>?$mobiles,
'dataType'?=>"xml"
))){
return?'-10000';
}else{
return?self::_replyResult($client->getContent);
}
}
總結(jié)
以上是生活随笔為你收集整理的php调http接口,2步教你解决http协议php接口调用的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: docker 启动成功但无法访问_doc
- 下一篇: 每个tabpage中都有一个dategr