当前位置: 首页>>代码示例>>PHP>>正文


PHP HttpClient::get_error_msg方法代码示例

本文整理汇总了PHP中HttpClient::get_error_msg方法的典型用法代码示例。如果您正苦于以下问题:PHP HttpClient::get_error_msg方法的具体用法?PHP HttpClient::get_error_msg怎么用?PHP HttpClient::get_error_msg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HttpClient的用法示例。


在下文中一共展示了HttpClient::get_error_msg方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: download_ushahidi

 /**
  * Fetches ushahidi from download.ushahidi.com
  * 
  * @param String url-- download URL
  */
 public function download_ushahidi($url)
 {
     $http_client = new HttpClient($url, 30);
     $results = $http_client->execute();
     $this->log[] = "Starting to download the latest ushahidi build...";
     if ($results) {
         $this->log[] = "Download of latest ushahidi went successful.";
         $this->success = true;
         return $results;
     } else {
         $this->errors[] = sprintf(Kohana::lang('libraries.upgrade_failed') . ": %d", $http_client->get_error_msg());
         $this->success = false;
         return $results;
     }
 }
开发者ID:rjmackay,项目名称:Ushahidi_Web,代码行数:20,代码来源:Upgrade.php

示例2: _curl_req

 /**
  * Helper function to send a cURL request
  * @param url - URL for cURL to hit
  */
 public function _curl_req($url)
 {
     $request = new HttpClient($url);
     $buffer = $request->execute();
     if ($buffer === FALSE) {
         throw new Kohana_Exception($request->get_error_msg());
     }
     return $buffer;
 }
开发者ID:Dirichi,项目名称:Ushahidi_Web,代码行数:13,代码来源:stats.php

示例3: layer

 /**
  * Read in new layer KML via HttpClient
  * @param int $layer_id - ID of the new KML Layer
  */
 public function layer($layer_id = 0)
 {
     $this->template = "";
     $this->auto_render = FALSE;
     $layer = ORM::factory('layer')->where('layer_visible', 1)->find($layer_id);
     if ($layer->loaded) {
         $layer_url = $layer->layer_url;
         $layer_file = $layer->layer_file;
         if ($layer_url != '') {
             // Pull from a URL
             $layer_link = $layer_url;
         } else {
             // Pull from an uploaded file
             $layer_link = Kohana::config('upload.directory') . '/' . $layer_file;
         }
         $layer_request = new HttpClient($layer_link);
         $content = $layer_request->execute();
         if ($content === FALSE) {
             throw new Kohana_Exception($layer_request->get_error_msg());
         } else {
             echo $content;
         }
     } else {
         throw new Kohana_404_Exception();
     }
 }
开发者ID:niiyatii,项目名称:crowdmap,代码行数:30,代码来源:json.php

示例4: reverseGoogle

 /**
  * Reverse Geocode a point using Google Geocode
  *
  * @author
  * @param   double  $latitude
  * @param   double  $longitude
  * @return  string  closest approximation of the point as a display name
  */
 static function reverseGoogle($lat, $lng)
 {
     if ($lat && $lng) {
         $url = Kohana::config('config.external_site_protocol') . '://maps.googleapis.com/maps/api/geocode/json?sensor=false&latlng=' . $lat . "," . $lng;
         $request = new HttpClient($url);
         if (!($json = $request->execute())) {
             Kohana::log('error', "Geocode - reverseGoogle\n" . $url . "\n" . $request->get_error_msg());
             return FALSE;
         }
         $location = json_decode($json);
         if ($location->status != 'OK') {
             // logs anything different from OK
             Kohana::log('error', "Geocode - reverseGoogle: " . $location->status . " - " . $location->error_message);
             return FALSE;
         }
         if (count($location->results) == 0) {
             return FALSE;
         }
         return $location->results[0]->formatted_address;
     } else {
         return FALSE;
     }
 }
开发者ID:Dirichi,项目名称:Ushahidi_Web,代码行数:31,代码来源:geocode.php


注:本文中的HttpClient::get_error_msg方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。