failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request
Posted
by
muralikalpana
on Stack Overflow
See other posts from Stack Overflow
or by muralikalpana
Published on 2010-12-27T14:10:10Z
Indexed on
2010/12/28
4:54 UTC
Read the original article
Hit count: 250
http
|httpwebrequest
I am accessing images from another website. I am getting "failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request " error when copying 'some(not all)' images. here is my code.
$img=$_GET['img']; //another website url
$file=$img;
function getFileextension($file) {
return end(explode(".", $file));
}
$fileext=getFileextension($file);
if($fileext=='jpg' || $fileext=='gif' || $fileext=='jpeg' || $fileext=='png' || $fileext=='x-png' || $fileext=='pjpeg'){
if($img!=''){
$rand_variable1=rand(10000,100000);
$node_online_name1=$rand_variable1."image.".$fileext;
$s=copy($img,"images/".$node_online_name1);
}
© Stack Overflow or respective owner