Home > Article > Backend Development > Using PHP, parsing error occurs when curl initializes
$arr = array(
0 => 'first',
1 => 'second',
2 => 'third'
);
echo json_encode($arr);
echo "
";
echo 1234;
phpinfo();
?>
$ch = curl_init();//Initialization
// curl_setopt($ch, CURLOPT_URL, "http://localhost/info.php?type=json");//Settings Options, including URL
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
//Execute and obtain the HTML document content
$output = curl_exec($ch);
//Release curl Handle
curl_close($ch);
//Print the obtained data
print_r($output);
?>