Maybe I\'ve been sat here too long staring at this but WHY would file_get_contents
return false
here? I\'ve cut and paste the URL and it works fine
Probably allow_url_fopen in your php.ini: http://php.net/manual/en/filesystem.configuration.php
Needs to be allowed.
You may need to enable allow_url_fopen in your php.ini
http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen
From the documentation:
This option enables the URL-aware fopen wrappers that enable accessing URL object like files.
Your server may be preventing you from opening a file located at a URL using file_get_contents.
Try this:
$query = http_build_query(array('search'=>$as_any, 'location'=>$location));
$url = "http://jobs.github.com/positions.json?" . $query;
The problem is that you weren't URL-encoding the search term, which contains a space. The request was returning a 400 error from the server, which you'd have noticed if you had error reporting enabled.
Sometimes if file_get_contents return false (not found) you should see if the url is encoded.
example:
http://test.net/демо/
Should be:
https://test.net/%D0%B4%D0%B5%D0%BC%D0%BE/