16 June 2012

cari url gambar dalam album picasa

cara nak dapatkan url gambar dari album picasa.


<?php
// Input
$user_name = "xxxx@gmail.com";
$picasa_album_id = "5726978903470698481";
// nak cari album id, gi kat picasaweb, masuk album, klik rss.

// build feed URL
$feedURL ="https://picasaweb.google.com/data/feed/api/user/$user_name/albumid/$picasa_album_id";
// read feed into SimpleXML object
$sxml = simplexml_load_file($feedURL);
// get album names and number of photos in each
$bil = 1;
foreach ($sxml->entry as $entry) {
    $urlgambar = $entry->content['src'];
    $path = split('/', $urlgambar);
    $s800gambar = $path[0].'//'.$path[2].'/'.$path[3].'/'.$path[4].'/'.$path[5].'/'.$path[6].'/s800/'.$path[7];
    print_r($path);
    print $s800gambar;
    $bil++;
}
?>

No comments:

Post a Comment

Terima kasih