0

I have a website (www.example.com | 123.456.789), in that machine i only have 1 web app running. i am trying to use php file_get_content() to a file which in my own server (located on some file like /var/www/my_site/public_html).

However it always returns error. When i try to do it manually, using CURL

Curl command

I can confirm that i can CURL other website such as ~$ curl google.com Can anyone suggest me what to do to resolve this. Thanks

I am using Ubuntu 14.04 LTS to host my webapp.

piit79
  • 184
  • 9
Jeremy
  • 129
  • 2
  • 10
  • What happens when you use `file_get_contents()` instead of curl? That would seem like a more appropriate function for getting the contents of a file. – Ladadadada Oct 20 '15 at 05:28
  • returns false followed by the full URL where the CURLed file resides. – Jeremy Oct 20 '15 at 05:33
  • Are the addresses that it tried to connect to correct (see the lines where you get the *Connection timed out* errors)? – Håkan Lindqvist Oct 20 '15 at 05:46
  • @HåkanLindqvist it reverts back to the IP address of my server, and yes it is the correct IP address – Jeremy Oct 20 '15 at 07:08
  • Are you passing in a *URL* to `file_get_contents()` or a file path? If it's on the same server, why are you not using a file path? – Ladadadada Oct 20 '15 at 09:38
  • @username55 It doesn't "revert back", it resolves the name to an IP address (this wasn't already in the cache, which the first message) and then connects to that address. It appears that it's the connection that fails. Firewall? – Håkan Lindqvist Oct 20 '15 at 16:41
  • @HåkanLindqvist Please convert your comment as an answer i will upvote it. Turns out there is some misconfigured acl. – Jeremy Nov 02 '15 at 06:34

0 Answers0