httpRequestFopen() public static method

Creates HTTP request using file_get_contents
public static httpRequestFopen ( string $url, string $method, boolean $return_only_status = false, mixed $content = null, string $header = "" ) : mixed
$url string Url to send the request
$method string HTTP request method (GET, POST, PUT, DELETE, etc)
$return_only_status boolean If set to true, the method would only return response status
$content mixed Content to be sent with HTTP request
$header string Header to be set for the HTTP request
return mixed
Example #1
0
 /**
  * Creates HTTP request
  *
  * @param string $url                Url to send the request
  * @param string $method             HTTP request method (GET, POST, PUT, DELETE, etc)
  * @param bool   $return_only_status If set to true, the method would only return response status
  * @param mixed  $content            Content to be sent with HTTP request
  * @param string $header             Header to be set for the HTTP request
  *
  * @return mixed
  */
 public static function httpRequest($url, $method, $return_only_status = false, $content = null, $header = "")
 {
     if (function_exists('curl_init')) {
         return Util::httpRequestCurl($url, $method, $return_only_status, $content, $header);
     } else if (ini_get('allow_url_fopen')) {
         return Util::httpRequestFopen($url, $method, $return_only_status, $content, $header);
     }
     return null;
 }