PHP error doing file_get_contents on a Hostinger host: failed to open stream

selan

I'm trying to use the http://ip-api.com/json/ api for get and show the information of a visitant that conects to my website on hostinguer.com.

When I do the next, it should responds me with a json with all the info in a json format:

echo file_get_contents("http://ip-api.com/json/{$user_ip}");

But I get the following error message:

Warning: file_get_contents(http://ip-api.com/json/[MY PUBLIC IP]): failed to open stream: Connection refused in /home/[HOSTINGUER USER]/public_html/ip2.php on line 31

And other strange thing: if I use another API it works correctly and returns me the correct Json! The other API command:

echo file_get_contents("http://ipinfo.io/{$user_ip}/json");

So, I want to use the ip-api.com API cause the results are more accurate, but only works if I use ipinfo.io API... Why can I do the petition to a website and not to the other?

Otherwhise, I tried both in local using curl or writting in my webrowser and it works correctly. Also I tried in local in a Lammp and the both works perfectly. And finally I tried somthing like this post: PHP file_get_contents() returns "failed to open stream: HTTP request failed!" in hostinguer and it doesn't works..

I thought maybe is something in the hostinguer configuration but...

Thanks in advance!

Vlad

Your IP address is banned. If you're using normal web hosting, your outgoing IP address is shared with other users, who probably did more requests than allowed.

Go to http://ip-api.com/docs/unban and enter your server's outgoing IP address (check it via http://ipinfo.io/json)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

file_get_contents() how to fix error "Failed to open stream", "No such file"

From Dev

file_get_contents() failed to open stream: No such file or directory

From Dev

PHP error failed to open stream/failed opening

From Dev

SplFileObject error failed to open stream: No such file or directory

From Dev

file_get_contents failed to open stream: HTTP request failed only for SPECIFIC web page

From Dev

failed to open stream: Permission denied file_get_contents which generates XML FILE

From Dev

PHP/WAMP: Failed to open stream error with uploaded file

From Dev

Failed to open stream on file_put_contents in PHP on CentOS 7

From Dev

Laravel classloader.php error failed to open stream: No such file or directory

From Dev

Telegram Bot PHP: Warning: file_get_contents failed to open stream: 400 Bad Request

From Dev

file_get_contents(): failed to open stream: No such file or directory

From Dev

I keep getting this error file_get_contents(failed to open stream: HTTP request failed! HTTP/1.1 400 BAD REQUEST

From Dev

PHP error doing file_get_contents on a Hostinger host: failed to open stream

From Dev

file_get_contents failed to open stream: HTTP request failed! HTTP/1.1 463

From Dev

How to resolve the error "[ErrorException] file_get_contents(/var/www/laravel/.env): failed to open stream: No such file or directory"?

From Dev

PHPUnit error "Failed to open stream: No such file or directory"

From Dev

"file_get_contents(http://127.0.0.1:8000/storage/config/xxx.ini): failed to open stream: HTTP request failed! "

From Dev

PHP error failed to open stream/failed opening

From Dev

failed to open stream: Permission denied file_get_contents which generates XML FILE

From Dev

PHP/WAMP: Failed to open stream error with uploaded file

From Dev

file_get_contents failed to open stream only with multiple

From Dev

yii PDO.php error: failed to open stream: No such file or directory

From Dev

PHP file_put_contents Failed to open stream, invalid argument

From Dev

PHP - file_get_contents failed to open stream: Connection closed?

From Dev

file_get_contents(): failed to open stream: No such file or directory

From Dev

file_get_contents with http - Failed to open stream

From Dev

PHP - failed to open stream error for uploaded image

From Dev

Creating Child Theme. "Warning: file_get_contents9():failed to open stream: No such file or directory" Error

From Dev

PHP: file_get_contents(): failed to open stream error - works on test XAMPP test server, not live

Related Related

  1. 1

    file_get_contents() how to fix error "Failed to open stream", "No such file"

  2. 2

    file_get_contents() failed to open stream: No such file or directory

  3. 3

    PHP error failed to open stream/failed opening

  4. 4

    SplFileObject error failed to open stream: No such file or directory

  5. 5

    file_get_contents failed to open stream: HTTP request failed only for SPECIFIC web page

  6. 6

    failed to open stream: Permission denied file_get_contents which generates XML FILE

  7. 7

    PHP/WAMP: Failed to open stream error with uploaded file

  8. 8

    Failed to open stream on file_put_contents in PHP on CentOS 7

  9. 9

    Laravel classloader.php error failed to open stream: No such file or directory

  10. 10

    Telegram Bot PHP: Warning: file_get_contents failed to open stream: 400 Bad Request

  11. 11

    file_get_contents(): failed to open stream: No such file or directory

  12. 12

    I keep getting this error file_get_contents(failed to open stream: HTTP request failed! HTTP/1.1 400 BAD REQUEST

  13. 13

    PHP error doing file_get_contents on a Hostinger host: failed to open stream

  14. 14

    file_get_contents failed to open stream: HTTP request failed! HTTP/1.1 463

  15. 15

    How to resolve the error "[ErrorException] file_get_contents(/var/www/laravel/.env): failed to open stream: No such file or directory"?

  16. 16

    PHPUnit error "Failed to open stream: No such file or directory"

  17. 17

    "file_get_contents(http://127.0.0.1:8000/storage/config/xxx.ini): failed to open stream: HTTP request failed! "

  18. 18

    PHP error failed to open stream/failed opening

  19. 19

    failed to open stream: Permission denied file_get_contents which generates XML FILE

  20. 20

    PHP/WAMP: Failed to open stream error with uploaded file

  21. 21

    file_get_contents failed to open stream only with multiple

  22. 22

    yii PDO.php error: failed to open stream: No such file or directory

  23. 23

    PHP file_put_contents Failed to open stream, invalid argument

  24. 24

    PHP - file_get_contents failed to open stream: Connection closed?

  25. 25

    file_get_contents(): failed to open stream: No such file or directory

  26. 26

    file_get_contents with http - Failed to open stream

  27. 27

    PHP - failed to open stream error for uploaded image

  28. 28

    Creating Child Theme. "Warning: file_get_contents9():failed to open stream: No such file or directory" Error

  29. 29

    PHP: file_get_contents(): failed to open stream error - works on test XAMPP test server, not live

HotTag

Archive