Skip to content

Instantly share code, notes, and snippets.

@BeFiveINFO
BeFiveINFO / get_curl_output_by_url
Last active August 29, 2015 14:17
Pass URL and it returns html by curl
<?php
/**
* This curl function might be useful when get_file_contents() cannot be used for any reasons.
* E.g. when you need to pass user agent etc.
*
* Todo: return array with response code & the content
*/
function get_curl_output_by_url ( $_curl_url ) {
$ch = curl_init();
$useragent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1";