Home  >  Article  >  Backend Development  >  php通过http调用验证码短信接口源码

php通过http调用验证码短信接口源码

WBOY
WBOYOriginal
2016-06-23 13:39:071584browse

通过验证码短信http调用接口,您可以很快速的在网站或者app中集成手机号验证功能,该源码只是核心代码,具体可以根据您的实际需求进行扩展。

<?phpfunction Post($curlPost,$url){		$curl = curl_init();		curl_setopt($curl, CURLOPT_URL, $url);		curl_setopt($curl, CURLOPT_HEADER, false);		curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);		curl_setopt($curl, CURLOPT_NOBODY, true);		curl_setopt($curl, CURLOPT_POST, true);		curl_setopt($curl, CURLOPT_POSTFIELDS, $curlPost);		$return_str = curl_exec($curl);		curl_close($curl);		return $return_str;}$target = "http://106.ihuyi.com/webservice/sms.php?method=Submit";//替换成自己的测试账号,参数顺序和wenservice对应$post_data = "account=用户名&password=密码&mobile=手机号码&content=".rawurlencode("您的验证码是:4852。请不要把验证码泄露给其他人。");//$binarydata = pack("A", $post_data);echo $gets = Post($post_data, $target);//请自己解析$gets字符串并实现自己的逻辑?>

自助申请帐户地址: http://www.ihuyi.com/product.php
完整接口文件地址: http://www.ihuyi.com/upload/file/cu-fa-jie-kou.rar  

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn