I'm constantly getting this error in the Nginx logs:
FastCGI sent in stderr: "PHP message: PHP Warning: file_get_contents(http://instance-data/latest/user-data): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found
The reason is that http://instance-data/latest/user-data is the AWS instance user data which is empty for this server.
How can I still read user-data in PHP, even if it is empty, without getting the error?
A short commit:
#file_get_contents("http://instance-data/latest/user-data");
Related
I have the following problem on a Magento2 Fresh installation with dummy data, using the theme [Revo]: https://themeforest.net/item/revo-responsive-magento-2-shopping-theme/18339484
Error filtering template: Warning:
getimagesize(https://website.com/media/wysiwyg/imageslider/slider-1.jpg):
failed to open stream: HTTP request failed! HTTP/1.1 401 Unauthorized
in
/var/www/html/nobacco/vendor/magento/framework/Image/Adapter/AbstractAdapter.php
on line 304
Permissions are correct, nginx settings seem good the image exists on the server and is accessible through the same url and the user rights seems alright too.. Any ideas?
Before this error I was getting an error on vendor/(cant remember the full path)/Image.php
I have an ajax call that gets many, many pages of contents from a website, but it fails to open steams sometimes even though the same exact links that failed to open streams works just fine, when I ran them again. The problem is, then other links would failed to open stream. Anyone know why this is happening?
Warning: file_get_contents(http://www.merriam-webster.com/browse/dictionary/a/acoustically.htm): failed to open stream: HTTP request failed!
I'm trying to make a plugin work on my site. can someone explain clearly what this error message means?:
Warning: fopen(http://example.com/wp-content/plugins/zoomsearch/zoomsearch.css): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/me/example.com/wp-content/plugins/zoomsearch_wpplugin/zoomsearch.php on line 197
i am trying to create a PNG resource from an image on a remote server, for that i use
$im = imageCreateFromPng('http://textures.minecraft.net/texture/7235ea086a4604e15e513c4add3935d64f23c535f9f62917c6d4886705ac8cf');
but when i execute the script it gives me this error:
Warning: imagecreatefrompng(*url*): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
I tried to access the url above with my browser and the image loaded just fine, then i made a head request to that URL to see if the server sends a 404 header but i found out that it does not. so i have no idea how to solve this issue, thank you for reading.
EDIT
everything works just fine on another server i own, just not this one.
I am trying to create a simple script that will retrieve the last 5 feeds for a twitter user (in this instance the BBC)
It runs okay locally on my development server but once I upload this to a live site I get the following error:
Warning: file_get_contents(https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=bbc&count=5): failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request in ....
Does anyone know why this doesn't work on my live server (but fine on my dev server?)
As mentioned in file_get_contents throws 400 Bad Request error PHP, you may be better using curl instead of file_get_contents due to its improved error handling - this may provide you with another clue.