I am using Curl for the first time in PHP. Here is my code.
<?php
function curl($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$data = curl_exec($ch);
echo curl_getinfo($ch) . '<br/>'; //returns "Array"
curl_errno($ch) . '<br/>'; // returns "7"
curl_error($ch) . '<br/>'; //returns "Failed connect to www.epcc.ed.ac.uk:80; No error"
curl_close($ch);
return $data;
}
$url = 'http://www.epcc.ed.ac.uk/education-training/general-training/upcoming-courses-and-events/';
$output = curl($url);
var_dump($output); // returns "bool(false)"
?>
I have added the output what I get in comments in the code.
Can anyone tell me where is the problem? Is it a general issue or any proxy issue.
Thanks