trgino adlı üyeden alıntı:
mesajı görüntüle
yani
a,b,c,d,e,f,g,h ile
1,2,3,4,5,6,7,8 i birleştirdiğimde şöyle oluyor
a,b,c,d,e,f,g,h,{BOŞ İNDİST},1,2,3,4,5,6,7,8
echo ile bastırınca 9. array kısmında hata veriyor. orayı nasıl çözebiliriz ?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Google Resim</title>
</head>
<?php
function dosyaIndir($url,$inecekDizin,$name){
$urlBilgisi = pathinfo($url);
$uzanti = strtolower($urlBilgisi['extension']);
$ism=$inecekDizin."/fmd_".$name."_".rand(1000,9999).".$uzanti";
$ch = curl_init($url);
$fopen = fopen($ism,'w');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FILE, $fopen);
curl_exec($ch);
curl_close($ch);
fclose($fopen);
return $ism; }
function al($l){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "$l");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // Allow redirection
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$a=curl_exec($ch);
curl_close($ch);
return $a; }
// Başlangıç
//https://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=resim&start=2&rsz=8
if(isset($_POST["kelime"]))
{
$kelime = ($_POST["kelime"]);
$kelime2 = str_replace(" ","+", $kelime);
$sayfa = ($_POST["sayfa"]);
$sayi = $sayfa*8;
$kac = 8;
$sayi2 = $sayi+$kac;
;
$url = "http://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=$kelime2&start=$sayi&rsz=8";
$url2 = "http://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=$kelime2&start=$sayi2&rsz=$kac";
echo "<form method=post >
Kelime : <input type=text name=kelime value='$kelime'>
Sayfa : <input type=text name=sayfa value='$sayfa' size='1' >
<input type=submit value='Ara' name=arama ><br>
</form><br>";
$a = al($url);
$aa = al($url2);
$b = explode("Gimage" ,$a);
$bb = explode("Gimage", $aa);
$b = array_merge($b, $bb);
//echo "<pre>";
//print_r($b);
$s = 1;
foreach($b as $c=>$d){
if($c>0){
$e=explode("\",\"url",$d);
$f=explode("\"unescapedUrl\":\"",$e[0]);
if(isset($f[1]))
{
$resimUrl=$f[1];
}
else
{
$f[1] = "yok";
}
$resimUrl = $f[1];
echo $c." - $resimUrl <br>";
// echo "<br> Kaynak : http://$nerden<br>";
}
}
}
else
echo "
<form method=post >
Kelime : <input type=text name=kelime>
Sayfa : <input type=text name=sayfa value='0' size='1' >
<input type=submit value='Ara' name=arama ><br>
</form>
";
?>