Hello!
I am newbie-newbie in php and I really don't understand why my code is not working. Would appreciate any help
<?php
$test = file_get_contents('http://en.wikipedia.org/w/api.php?action=query&prop=extracts&format=xml&exintro=1&titles=PHP');
echo strlen($test);
echo $test;
?>
Strlen is 0. I think, that the URL is not working. However if I use some other URL, like http://en.wikipedia.org, it is alright.
Also, if I download the url, it is working:
<?php
$test = file_get_contents('C:\xampp\htdocs\university\gui\plain\api.php.xml');
echo strlen($test);
echo $test;
?>
Strlen is higher than 0 and code is returned.
What's wrong with the first code?
Thank you in advance!