/    Sign up×
Community /Pin to ProfileBookmark

imagecreatefromstring(file_get_contents($url)) failing… help!

I’m having problems with accessing the PNG from this url:
[url]http://199.104.104.118/slc/projects/anomalies/Forecast/GEFS/archive/20100223/00z/gefs_00z_250hgtanom_f00.png[/url]

for use with
[B]imagecreatefromstring(file_get_contents($url))[/B]
or
[B]imagecreatefrompng($url)[/B]

I want to take the image here, use the commands above, then evaluate the colors pixel by pixel of a certain region. This script works if I have a local copy of the image. You could say, why don’t you just copy the image to a local directory first? I would, but file_get_contents/curl returns [B]null[/B] data. It’s as if the file is empty anytime I try to do anything other than display it. <img src=$url> works, but nothing else does. Ideas?

Thanks

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@NogDogAug 01.2011 — Maybe the site hosting it looks at something in the HTTP request -- such as User Agent? -- and rejects anything that looks like a robot or other script? If so, you might need to use cURL to access the URI and add some request headers to make it "look" like a normal browser request. (I'm assuming you've already ruled out something like allow_url_fopen being diabled in your PHP config?)
×

Success!

Help @mith36 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.17,
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,
)...