I want to get results from Google. According to web API doc of Google this is my code.
<!DOCTYPE html>
<html>
<head>
<title>testing</title>
</head>
<body>
<?php
$page = 10;
$query = "Baby";
$url = "https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=".$query;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)');
$body = curl_exec($ch);
curl_close($ch);
$json = json_decode($body);
var_dump($json);
echo $json;
?>
</body>
</html>
But I am not getting anything on page neither error. Can anyone help me to figure it out why its not working and how to catch errors?