Call Mode xxx.php?user=xxx
Guaranteed program to put the current directory writable folder writable file
The default storage mode is
./user Name/album 1 description/Picture description-1. Picture suffix
function open ($host, $file) {
$return = "";
$header =;
while ($header!=200) {
$fp = Fsockopen ($host, $errno, $errstr, 30);
if (! $fp) {
echo "$errstr ($errno)
n ";
} else {
$out = "GET $file http/1.1rn";
$out. = "Host: $hostrn";
$out. = "p3p:cp=" CAO PSA our "RN";
$out. = "user-agent:baiduspider+ (+[url]http://www.baidu.com/search/spider.htm[/url]) rn";
$out. = "Connection:closernrn";
Fwrite ($fp, $out);
while (!feof ($fp)) {
$return. = Fgets ($fp, 1024);
}
Fclose ($FP);
}
Preg_match ("/http/1.1 (. *?) ok/", $return, $output);
$header = $output [1];
}
Preg_match ("/rnrn (. +)/is", $return, $out);
$return = $out [1];
Return mb_convert_encoding ($return, "GB2312", "UTF-8");;
}
function openimg ($host, $file) {
$return = "";
$header = 302;
while ($header ==302) {
$fp = Fsockopen ($host, $errno, $errstr, 30);
if (! $fp) {
echo "$errstr ($errno)
n ";
} else {
$out = "GET $file http/1.1rn";
$out. = "Host: $hostrn";
$out. = "user-agent:baiduspider+ (+[url]http://www.baidu.com/search/spider.htm[/url]) rn";
$out. = "Connection:closernrn";
Fwrite ($fp, $out);
while (!feof ($fp)) {
$return. = Fgets ($fp, 1024);
}
Fclose ($FP);
}
Preg_match ("/http/1.0 (. *?) /", $return, $output);
$header = $output [1];
}
Preg_match ("/rnrn (. +)/is", $return, $out);
$return = $out [1];
if ($header ==404) $return =;
return $return;
}
function img ($host, $file, $dir, $name) {
$data = Openimg ($host, $file);
Echo $dir;
$blankimg =.. /images/blank.jpg;
$filename = $dir./. $name;
echo $filename;
if (!is_dir ($dir)) {
if (!mkdir ($dir)) Die (create dir error);
}
Echo $data;
if (! $handle = fopen ($filename, w+)) {
echo "Cant open $filename";
Exit
}
if (fwrite ($handle, $data) = = = = FALSE) {
echo "Cant write $filename";
Exit
}
echo "Write to $filename done";
Fclose ($handle);
echo $filename. "
RN ";
}
$aid = ($_get[aid]!=)? $_get[aid]:0;
$user = $_get[user];
if (!is_dir ($user)) {
if (!mkdir ($user)) Die (create dir error);
}
if ($user = =) Die ("User string cant is blank");
$userstr =/. $user./;
$html = Str_replace ("",, open (picasaweb.google.com, $userstr));
Preg_match_all ("/,access:publicn,title: (. *?) N,url: (. *?) N,src/s ", $html, $album);
$all = count ($album [1]);
if ($aid > $all) die (OK);
$aurl = Str_replace (x2f,/, $album [2][$aid]);
$astr =./. $user./. $album [1][$aid];
$afile = Str_replace (http://picasaweb.google.com,, $aurl);
$html = Str_replace ($,,open (picasaweb.google.com, $afile));
Preg_match_all ("/" Summarytype ":" Text "," Summary ":" (. *) "," contenttype ":" (. *) "," Contentsrc ":" (. *) "," link ":/S", $html, $pics);
$allpic = count ($pics [3]);
for ($i =0; $i < $allpic; $i + +) {
$pic = $pics [3][$i];
$typetemp = Explode (., $pic);
$type = $typetemp [(Count ($typetemp)-1)];
$pname = $pics [1][$i].-$i ... $type;
$temp = Explode (ggpht.com, $pic);
$imghost = Str_replace (http://,, $temp [0].ggpht.com);
$imgfile = $temp [1];
IMG ($imghost, $imgfile, $astr, $pname);
}
$aid + +;
Echo ;
?>
Download Google albums
http://www.bkjia.com/PHPjc/486527.html www.bkjia.com true http://www.bkjia.com/PHPjc/486527.html techarticle Call Way Xxx.php?user=xxx Ensure that the program puts the current directory writable folder writable file is stored by default./username/album 1 description/Picture description-1. picture suffix? php function o ...