File_get_content IS throwing me errors

I’m trying to get the script to connect to a txt file, open it, get first line of text in txt file, then turn it into a variable, once it has the variable $url it is then placed into the file_get_content(), the finish product should then shoots out onto the page. My host allows fopen content so it can’t be that. The url is correct as I tested with typing it in fully in file_get_content but if it’s a variable in it’s place like file_get_conent($url) I get this error. Perhaps it’s adding something when I fetch the first line in the file I really don’t see how since it’s a text file and I haven’t added anything else except three lines of text.

The Error:
Warning: file_get_contents(http://some_web_url.php ) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in

 // opens temp data file
$fetch_url = file('http://website.com/example.txt');
// fetches first line: $fetch_url[0];
$url = $fetch_url[0];

$file_string = file_get_contents($url);

I just don’t understand why this darn thing an’t workin. :nono:

Have you examined the contents of $url to see whether it is as you expect? Also I note that if the url contains any ‘special’ characters it must be encoded, though I assume you’d have had the same problem when you typed it directly. Can you show the contents of the file here?

A common security setting prevents the fopen family of functions (of which file_get_contents is a member) from opening remote files. It is advised that you leave the setting alone and use cURL.

Here’s information on the setting.

http://php.net/manual/en/filesystem.configuration.php

You have been warned.