public static function get($url, $params = array()) { $defaults = array('method' => 'GET', 'data' => array()); $options = array_merge($defaults, $params); $query = http_build_query($options['data']); if (!empty($query)) { $url = \Instagram\Url::hasQuery($url) ? $url . '&' . $query : $url . '?' . $query; } // remove the data array from the options unset($options['data']); $request = new self($url, $options); return $request->response(); }
/** * Static method to send a HEAD request * * @param string $url * @param array $params * @return object Response */ public static function head($url, $params = array()) { $defaults = array('method' => 'HEAD'); $request = new self($url, array_merge($defaults, $params)); return $request->response(); }
static function post($url, $data = array(), $headers = "", $cookie = array()) { if (!($url = self::parse_url($url))) { return false; } $http = new self($url['host'], $url['port'] ? $url['port'] : 0, $url['scheme'] == "https"); if (!$http->request("POST", $url['path'] . ($url['query'] ? "?{$url['query']}" : ""), $data ? $data : "", $headers, $cookie)) { return false; } return $http->response(); }