Failed to open stream: HTTP request failed
Hi friends,
I am trying to run a script that reads images URL from RSS xml and display it but if any image URL has a space on it, it gives a message as HTTP request failed . Even if i try to copy paste the URL and try to displays in the browser over there also i am getting some error message. Can anyone tell me what should i do in this case.
Failed to open stream: HTTP request failed
Sure i will help you out with this before that can you provide me the code which you are using it and have a check for the same it might happen that the image which you are trying o stream might have some permission set because of which you are not getting HTTP request failed
Failed to open stream: HTTP request failed
I had a check for the same there is no permission set for the image and i am trying to sue the following Php code where i am getting HTTP request failed
PHP Code:
<?php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Tuesday, 26 Jul 2012 07:15:00 GMT");
header ("Content-type: image/png");
$background = imagecreatefrompng("./backround_image1.png");
$xml = file_get_contents("./rss.php?xml=true");
preg_match_all('/<(artist|song|image)>([^<]+)<\/\\1>/i', $xml, $matches);
list($artist, $song, $imageurl) = $matches[2];
$insert1 = imagecreatefromjpeg($imageurl);
imagecopymerge($background,$insert,45,60,0,0,90,90,100);
HTTP request failed in Php
Try to use the following code and i am sure after using this code you won't be getting HTTP request failed i had a check the code and it's working fine for me hope it works for you too.
PHP Code:
str_replace():
$insert = imagecreatefromjpeg(str_replace(' ', '%20', $imageurl));