Beispiel #1
0
 static function getUserInfo($access_token)
 {
     $curl = new Curl();
     $url = SSO_USER_INFO_URL . "&access_token=" . $access_token;
     $res = $curl->get($url);
     $body = json_decode($res['body'], 1);
     $user_info = null;
     if ($body['error'] == 0) {
         $user_info = $body['result'];
         //self::_debug($user_info);
     }
     return $user_info;
 }
Beispiel #2
0
 static function api($action, $query, $use_ip = false)
 {
     $curl = new Curl();
     try {
         $url = self::get_url($action, $query, $use_ip);
         self::_debug($url);
         $response = $curl->get($url, array(CURLOPT_REFERER => PASSPORT_HOST));
         //self::_debug($response);
     } catch (Exception $e) {
         self::_error($e->getMessage());
         _throw("call passport api error");
     }
     return self::handle_response($response);
 }
Beispiel #3
0
 static function send($mobile, $content)
 {
     try {
         $username = "******";
         $key = "32215d41412320e5315b";
         $curl = new Curl();
         $url = "http://utf8.sms.webchinese.cn/?Uid={$username}&Key={$key}&smsMob={$mobile}&smsText=" . urlencode($content);
         $res = $curl->get($url);
         $body = $res['body'];
         self::_debug($mobile);
         self::_debug($content);
         self::_debug($body);
         return $body;
     } catch (Exception $e) {
         _throw($e->getMessage());
     }
 }
Beispiel #4
0
 static function convert_gps($latx, $lngy)
 {
     //PtApp::$setting['qq_map']['key_service']
     $key = Model_Setting::get("qq_map_key_service1");
     if (!$key) {
         Model_Setting::add("qq_map_key_service1", "I6OBZ-EFNHR-JAZWY-WHLXW-O3TOH-EIFLA", "QQ地图 SERVICE KEY");
         Model_Setting::add("qq_map_key_js", "66DBZ-IG7WJ-G2CFQ-KVS4Z-PBQA5-WQFLR", "QQ地图 JS KEY");
     }
     $url = "http://apis.map.qq.com/ws/coord/v1/translate";
     $data = array("locations" => $latx . "," . $lngy, "type" => 1, "key" => $key);
     $curl = new Curl();
     $url = $url . "?" . http_build_query($data);
     $res = $curl->get($url);
     $body = json_decode($res['body']);
     if ($body->status > 0) {
         throw new Exception($body->message);
     }
     return $body->locations[0];
 }