PHP: file_get_contents failed to open stream: Connection refused

前端 未结 3 1695
孤街浪徒
孤街浪徒 2021-01-23 05:29

I am trying to access a second server with file_get_contents and simple_load_xml and I get \"failed to open stream: Connection refused\"
What can be the result?



        
相关标签:
3条回答
  • 2021-01-23 05:52

    Sounds like the 2nd server is rejecting the file, try using curl to obtain the file instead; the benefit of using curl is that it'll give you helpful debugging information in the event of a failure like this. get_file_content() masks a lot of this helpful information.

    0 讨论(0)
  • 2021-01-23 05:54

    Your connection to the resource is being rejected. Ensure that you can access the resource from the server (Using Lynx for instance).

    0 讨论(0)
  • 2021-01-23 06:02

    I believe this is because you need a resource - fopen(), instead of a string - file_get_contents()

    0 讨论(0)
提交回复
热议问题