I am learning about web service and I had a problem trying to consume a static data file data.txt
this is my index.php
<?php
$curl = curl_init("http://localhost/web_service/base.txt");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$answer = curl_exec($curl);
$info = curl_getinfo($curl);
if ($info['http_code' == 200] ){
$data = explode(",", $answer);
foreach ($data as $fruit) {
echo "-> ". $fruit ."<br>";
}
} else {
echo "error" . curl_error($curl);
}
?>
And my base.txt contains only
Banana, Apple, watermelon
this is the error:
The localhost page is not working
Localhost is unable to process this request at this time.
HTTP ERROR 500
I do not understand this error, my apache server is started.
I hope can you help me :)