Skip to content

@timw4mail /curl.php
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Simple Curl function for retrieving a remote url
<?php
function do_curl($url, $options=array())
{
$cookie = tempnam ("/tmp", "CURLCOOKIE");
$ch = curl_init($url);
//Use the user's User Agent and Cookies
$opts= array(
CURLOPT_USERAGENT => $_SERVER['HTTP_USER_AGENT'],
CURLOPT_COOKIEJAR => $cookie,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_ENCODING => "",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_AUTOREFERER => true,
CURLOPT_SSL_VERIFYPEER => FALSE,
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_TIMEOUT => 10,
CURLOPT_MAXREDIRS => 10,
CURLOPT_PROTOCOLS => array(CURLPROTO_HTTP,CURLPROTO_HTTPS)
);
$options = array_merge($opts, $options);
curl_setopt_array($ch, $options);
return curl_exec($ch);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.