Home  >  Article  >  Backend Development  >  Using PHP, parsing error occurs when curl initializes

Using PHP, parsing error occurs when curl initializes

WBOY
WBOYOriginal
2016-08-26 10:12:58901browse

$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);
?>

Using PHP, parsing error occurs when curl initializes

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn