本文整理汇总了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;
}
}
示例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;
}
示例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();
}
}
示例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;
}
}