php - Checking if Image exist using url returns false in some ocasions -


I'm thinking that this code will fail falsely. When passing some image URL it returns false results, but I do not have control over what URL is, but can I encode it to work in any way?

I think the problem lies with the location located in the image URL, how to avoid it?

  Check functionremotefile ($ url) {$ ch = curl_init (); Curl_setopt ($ ch, CURLOPT_URL, $ url); // content do not download curl_setopt ($ CH, CURLOPT_NOBODY, 1); Curl_setopt ($ CH, CURLOPT_FAILONERROR, 1); Curl_setopt ($ CH, CURLOPT_RETURNTRANSFER, 1); Return (curl_exec ($ ch)! == incorrect); }    

Use $ url = str_replace ('', '% 20 ', $ Url); Urlencode empty space from .

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -