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.