示例#1
0
 /**
  * @param string $url
  * @param string $username
  * @param string $password
  * @return \SimpleXMLElement|boolean
  * @throws Exception
  */
 public static function getData($url, $username = false, $password = false)
 {
     $request = new HttpRequest($url, self::$connection_timeout);
     if ($username !== false && $password !== false) {
         $request->useAuthentication($username, $password);
     }
     $response = $request->send(true);
     if ($response !== false) {
         return simplexml_load_string($response);
     }
     return false;
 }
示例#2
0
 /**
  * @param string $url
  * @return mixed|boolean
  * @throws Exception
  */
 public static function getData($url, $username = false, $password = false)
 {
     $request = new HttpRequest($url);
     if ($username !== false && $password !== false) {
         $request->useAuthentication($username, $password);
     }
     $reponse = $request->send(true);
     if ($reponse !== false) {
         $reponseData = json_decode($reponse, true);
         if ($reponseData['RESULT_CODE'] === 1000) {
             return $reponseData['RESULT_DATA'];
         } else {
             self::processError($reponseData['RESULT_CODE']);
         }
     }
     return false;
 }