本文整理汇总了PHP中Curl::disconnect方法的典型用法代码示例。如果您正苦于以下问题:PHP Curl::disconnect方法的具体用法?PHP Curl::disconnect怎么用?PHP Curl::disconnect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Curl
的用法示例。
在下文中一共展示了Curl::disconnect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getToken
public function getToken()
{
$username = self::CONFIG_USERNAME;
$password = self::CONFIG_PASSWORD;
$time = time();
$hash = md5("{$username}@{$password}@{$time}");
$auth = "{$username}@{$time}@{$hash}";
$ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
$url = 'http://axe.mappy.com/1v1/token/generate.aspx?' . 'auth=' . urlencode($auth) . '&' . 'ip=' . urldecode($ip);
/**
$remote = @fopen($url, 'rb');
if ( false === $remote )
return false;
$token = '';
while ( !( feof($remote) ) )
$token .= fread($remote, 8192);
fclose($remote);
*/
$curl = new Curl($url);
$curl->request();
$resp = $curl->response();
$curl->disconnect();
return $resp['body'];
}
示例2: request
protected function request($url)
{
$curl = new Curl($url);
$curl->request();
$this->response = $curl->response();
$curl->disconnect();
if ($this->response['status']) {
if ($this->response['status']['code'] == 200) {
return $this->response['body'];
}
throw new Exception($this->response['status']['message'], $this->response['status']['code']);
}
throw new Exception('Error!');
}
示例3: request
protected function request($url, $post = false)
{
if (true === $post || is_array($post)) {
$curl = new Curl($url, CURLOPT_POST, true === $post ? array() : $post);
} else {
$curl = new Curl($url);
}
$curl->request();
$this->response = $curl->response();
$curl->disconnect();
if ($this->response['status']) {
if ($this->response['status']['code'] == 200) {
return $this->response['body'];
}
throw new Exception($this->response['status']['message'], $this->response['status']['code']);
}
throw new Exception('Error!');
}