public static function sendMessage($p_telephone, $p_msg) { $_r = null; if (W2String::isTelephone($p_telephone)) { // $strSendMsg = $p_msg; // $strSendMsg = iconv('UTF-8', 'GBK', $strSendMsg); // $strSendMsg = urlencode($strSendMsg); // $_r = '测试期,暂不发送实际短信'; // $strUrl ="http://125.208.9.42:8080/WS/Send.aspx?CorpID=btapp&Pwd=123456&Mobile={$strTelephone}&Content={$strSendMsg}"; // $_r = W2Web::loadStringByUrl($strUrl); $data = array(); $data['user'] = W2Config::$SMS_USER; $data['passwd'] = W2Config::$SMS_PASSWD; $data['msg'] = $p_msg; //短消息内容,UTF-8编码 $data['mobs'] = $p_telephone; //手机号码,逗号分隔,个数最多100 $data['ts'] = date('YmdHi', time()); //计划发送时间,格式“yyyyMMddHHmm”,默认当前 $data['dtype'] = 0; //响应数据格式;0,普通字串,1.XML格式,默认0 $data['passwd'] = md5($data['user'] . $data['passwd']); //MD532位加密用户名和API密码 $_r = W2Web::loadStringByUrl('http://api5.nashikuai.cn/SendSms.aspx', 'post', $data); } return $_r; }
/** * 查询快递信息 * @param string $postid 快递单号 * @param string $type 快递类型 * shentong ---> 申通 * ems ---> EMS * shunfeng --> 顺丰 * yuantong --> 圆通 * zhongtong --> 中通 * yunda --> 韵达 * tiantian ---> 天天快递 * huitongkuaidi --> 汇通快递 * quanfengkuaidi --> 全峰快递 * debangwuliu --> 德邦物流 * zhaijisong --> 宅急送 * @return [type] [description] */ public static function query($postid = "268323324324", $type = "shentong") { $post_data = array("type" => $type, "postid" => $postid); $url = 'http://www.kuaidi100.com/query'; $result = W2Web::loadStringByUrl($url, 'get', $post_data); return json_decode($result, true); }
public static function actionTest() { $result = W2Web::loadStringByUrl('http://api-haoye.appzd.net/apitest/apitest.php', 'post', $_POST, array("Test:\r\n", 'Test2:2')); echo $result; exit; }
/** * 发送http请求, 返回Json数组 * @param string url * @return array Json 数组 */ public static function loadJsonByUrl($p_url) { $_c = W2Web::loadStringByUrl($p_url); return isset($_c) ? json_decode($_c, true) : $_c; }