本文整理匯總了PHP中http_class::close方法的典型用法代碼示例。如果您正苦於以下問題:PHP http_class::close方法的具體用法?PHP http_class::close怎麽用?PHP http_class::close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類http_class
的用法示例。
在下文中一共展示了http_class::close方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: array
function open_url($type, $params = array())
{
$http = new http_class();
$http->request_method = 'POST';
$http->user_agent = "cesar-rodas/1.0 | Akismet-Class/" . CLASS_VERSION;
$http->follow_redirect = 1;
$http->redirection_limit = 5;
$http->exclude_address = "";
$http->protocol_version = "1.1";
$http->GetRequestArguments($this->get_url($type), $arguments);
$arguments['PostValues'] = $params;
$this->err = $http->Open($arguments);
if ($this->err != "") {
return false;
}
$this->err = $http->SendRequest($arguments);
if ($this->err != "") {
return false;
}
$this->err = $http->ReadReplyHeaders($gHeaders);
if ($this->err != "") {
return false;
}
if ($http->response_status != 200) {
$this->err = "Pages status: " . $http->response_status;
$http->Close();
return false;
}
$response = '';
for (;;) {
$this->error = $http->ReadReplyBody($body, 1000);
if ($this->error != "" || strlen($body) == 0) {
break;
}
$response .= $body;
}
$http->close();
return $response;
}
示例2: http_adv_get
function http_adv_get($qtype, $url, $extra = array(), $headers = array())
{
$http = new http_class();
$http->debug = 0;
$http->html_debug = 0;
$http->request_method = $qtype;
$http->GetRequestArguments($url, $args);
$err = $http->Open($args);
foreach ($extra as $key => $value) {
$args[$key] = $value;
}
$body = "";
foreach ($headers as $key => $value) {
$args['Headers'][$key] = $value;
}
if ($err == "") {
$err = $http->Open($args);
$err = $http->SendRequest($args);
$http->ReadReplyHeaders($headers);
if ($err == "") {
if ($err == "") {
for (;;) {
$err = $http->ReadReplyBody($acc, 2000);
if ($err != "" || $acc == "") {
break;
}
$body .= $acc;
}
}
}
$http->close();
}
return array($headers, $body);
}