Code: Select all
function DownloadUrl($Url, $p){
// is curl installed?
if (!function_exists('curl_init')){
die('CURL is not installed!');
}
// create curl resource
$ch = curl_init();
// set url
curl_setopt($ch, CURLOPT_URL, $Url);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $p);
curl_setopt ($ch, CURLOPT_POST, 1);
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// $output contains the output string
$output = curl_exec($ch);
if($output === false)
echo 'Curl error: ' . curl_error($ch);
else
print $output;
// close curl resource to free up system resources
curl_close($ch);
}