/    Sign up×
Community /Pin to ProfileBookmark

Problem with url open

Code

[code=php]<?php

if (file_get_contents(“http://example.com/”)){
echo “Working!”;
}else{
echo “Why, why, why?”;
}

?>[/code]

For some reason I get error_message [B]Warning: file_get_contents([url]http://example.com/[/url]) [function.file-get-contents]: failed to open stream: Host is down in[/B].

Tried it without my own firewall.
In php.ini:
allow_url_fopen = On
safe_mode = Off

What is could be cousing this problem?

(And yes, I have tried it with n-number of url -> not working at my home computer, but works perfectly at server; so the problem is definetly at my computer, but…?)

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@SheldonMay 22.2007 — try looking at [url=http://php.net/fsocketopen]fsocketopen[/url]
Copy linkTweet thisAlerts:
@JToauthorMay 22.2007 — I actually tried it already with the example http://at2.php.net/manual/en/function.fsockopen.php-code at PHP.net page - same problem occurs...
Copy linkTweet thisAlerts:
@JToauthorMay 24.2007 — Doesn't anyone have any kind of solutions or workarounds for this?

I'm using Mac OS X with MAMP.

My purpose is to be able to load xml-file from one of my servers and do something with it...
×

Success!

Help @JTo spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...