forked from GNUsocial/gnu-social
add get to curl client
This commit is contained in:
parent
9a9a0ae56f
commit
6b7f09eba6
@ -60,8 +60,31 @@ class CurlClient extends HTTPClient
|
|||||||
curl_setopt_array($ch,
|
curl_setopt_array($ch,
|
||||||
array(CURLOPT_NOBODY => true));
|
array(CURLOPT_NOBODY => true));
|
||||||
|
|
||||||
|
if (!is_null($headers)) {
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||||
|
}
|
||||||
|
|
||||||
$result = curl_exec($ch);
|
$result = curl_exec($ch);
|
||||||
|
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
return $this->parseResults($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
function get($url, $headers=null)
|
||||||
|
{
|
||||||
|
$ch = curl_init($url);
|
||||||
|
|
||||||
|
$this->setup($ch);
|
||||||
|
|
||||||
|
if (!is_null($headers)) {
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = curl_exec($ch);
|
||||||
|
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
return $this->parseResults($result);
|
return $this->parseResults($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,8 +93,7 @@ class CurlClient extends HTTPClient
|
|||||||
curl_setopt_array($ch,
|
curl_setopt_array($ch,
|
||||||
array(CURLOPT_USERAGENT, $this->userAgent(),
|
array(CURLOPT_USERAGENT, $this->userAgent(),
|
||||||
CURLOPT_HEADER => true,
|
CURLOPT_HEADER => true,
|
||||||
CURLOPT_RETURNTRANSFER => true,
|
CURLOPT_RETURNTRANSFER => true));
|
||||||
CURLOPT_HTTPHEADER => $headers));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function userAgent()
|
function userAgent()
|
||||||
|
Loading…
Reference in New Issue
Block a user