문제

Three hours ago I was working on my site, then I had a nap, and now my file_get_contents request isn't working.

$Url = sprintf( "http://www.wowhead.com/item=%u?xml", $EntryId );
$Xml = file_get_contents( $Url );    

Display ID for example could be 30987. The url formed: http://www.wowhead.com/item=30987?xml This works in a browser - but in my site I get: failed to open stream: HTTP request failed!.

I don't really get it - because it worked perfectly just 3 hours ago.

Does anyone have any idea? Thanks.

도움이 되었습니까?

해결책

They way you are reading the HTTP content can be the problem. You are reading it as a file. That does not send proper HTTP headers. Server may refuse to serve the page contents when the request is not formatted properly. Read the contents of the URL using HTTPRequest

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top