HTTPClient get $params array and oEmbedHelper uses it

This commit is contained in:
Mikael Nordfeldth
2015-11-30 01:28:18 +01:00
parent fbe0e68617
commit b7edac2610
3 changed files with 25 additions and 40 deletions

View File

@@ -177,8 +177,17 @@ class HTTPClient extends HTTP_Request2
/**
* Quick static function to GET a URL
*/
public static function quickGet($url, $accept=null)
public static function quickGet($url, $accept=null, $params=array())
{
if (!empty($params)) {
$params = http_build_query($params, null, '&');
if (strpos($url, '?') === false) {
$url .= '?' . $params;
} else {
$url .= '&' . $params;
}
}
$client = new HTTPClient();
if (!is_null($accept)) {
$client->setHeader('Accept', $accept);