mymps.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. function Post($curlPost, $url)
  3. {
  4. $curl = curl_init();
  5. curl_setopt($curl, CURLOPT_URL, $url);
  6. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  7. curl_setopt($curl, CURLOPT_POST, true);
  8. curl_setopt($curl, CURLOPT_POSTFIELDS, $curlPost);
  9. $return_str = curl_exec($curl);
  10. curl_close($curl);
  11. return $return_str;
  12. }
  13. function msend_regsms($sms_user, $sms_pwd, $mobile, $yzm, $sms_regtpl = '')
  14. {
  15. global $charset;
  16. $target = 'http://api.weimi.cc/2/sms/send.html';
  17. $post_data = 'uid=' . $sms_user . '&pas=' . $sms_pwd . '&mob=' . $mobile . '&cid=' . $sms_regtpl . '&p1=' . $yzm . '&type=json';
  18. $gets = object_array(json_decode(post($post_data, $target)));
  19. if ($charset == 'gbk') {
  20. $gets['msg'] = iconv('UTF-8', 'GBK', $gets['msg']);
  21. }
  22. if ($gets['code'] == 0) {
  23. }
  24. write_sms_sendrecord($mobile, $sms_regtpl, $gets['msg'], 'weimi');
  25. }
  26. function msend_pwdsms($sms_user, $sms_pwd, $mobile, $yzm, $sms_pwdtpl = '')
  27. {
  28. global $charset;
  29. $target = 'http://api.weimi.cc/2/sms/send.html';
  30. $post_data = 'uid=' . $sms_user . '&pas=' . $sms_pwd . '&mob=' . $mobile . '&cid=' . $sms_pwdtpl . '&p1=' . $mobile . '&p2=' . $yzm . '&type=json';
  31. $gets = object_array(json_decode(post($post_data, $target)));
  32. if ($charset == 'gbk') {
  33. $gets['msg'] = iconv('UTF-8', 'GBK', $gets['msg']);
  34. }
  35. if ($gets['code'] == 0) {
  36. }
  37. write_sms_sendrecord($mobile, $sms_pwdtpl, $gets['msg'], 'weimi');
  38. }
  39. function object_array($array)
  40. {
  41. if (is_object($array)) {
  42. $array = (array) $array;
  43. }
  44. if (is_array($array)) {
  45. foreach ($array as $key => $value) {
  46. $array[$key] = object_array($value);
  47. }
  48. }
  49. return $array;
  50. }
  51. include_once MYMPS_INC . '/openlogin.fun.php';
  52. ?>