Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Итоговый отчет.docx
Скачиваний:
6
Добавлен:
20.12.2018
Размер:
4.08 Mб
Скачать
    1. Код приложения для работы с web сервисом Google

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">

<?php

$userid = 'Lysedenis@yandex.ru';

$album = 'Test_album';

// build feed URL

$feedURL = "http://picasaweb.google.com/data/feed/api/user/$userid/album/$album";

// read feed into SimpleXML object

$sxml = simplexml_load_file($feedURL);

$file = "images.xml";

if (is_file($file))//if file exists

{

$handle = fopen($file, "w");//only write, the content of the file is deleted

fwrite($handle, "<Carousel target=\"_blank\">\n");

//read the xml file from picasa

foreach ($sxml->entry as $entry)

{

$title = $entry->title;

$summary = $entry->summary;

$gphoto = $entry->children('http://schemas.google.com/photos/2007');//??

$size = $gphoto->size;

$height = $gphoto->height;

$width = $gphoto->width;

$media = $entry->children('http://search.yahoo.com/mrss/');//??

$thumbnail = $media->group->thumbnail[2];

$content = $media->group->content;

$tags = $media->group->keywords;

fwrite ($handle, "<photo image=\"");

fwrite ($handle, $content->attributes()->{'url'});//set the url of the image

fwrite ($handle, "\" target=\"_blank\"");

fwrite ($handle, "url=\"");

fwrite ($handle, $content->attributes()->{'url'});//set the url of the image

fwrite ($handle, "\">");

fwrite ($handle, "<![CDATA[");

fwrite ($handle, $summary);

fwrite ($handle, "]]>");

fwrite ($handle, "</photo>");

fwrite ($handle, "\n");

}

fwrite($handle, "</Carousel>");

//echo("Xml file has been successfully written");

echo("<br><br>");

}

else

echo "The file $file does not exist or it is not a valid file!";

echo("<br><br>");

fclose($handle);

?>

<head>

<title></title>

<META HTTP-EQUIV="Content-Type" Content="Text/html;charset=Windows-1251">

<script type="text/javascript" src="swfobject.js"></script>

<script type="text/javascript">

var flashvars = {};

var params = {};

params.scale = "noscale";

params.salign = "tl";

params.wmode = "transparent";

var attributes = {};

swfobject.embedSWF("3DCarouselMenuFX.swf", "CarouselDiv", "900", "650", "9.0.0", false, flashvars, params, attributes);

</script>

</head>

<body bgcolor="#999999">

<center><h1>Публикация с web сервиса Picasa</h1></center>

<center>

<div id="CarouselDiv">

<a href="http://www.adobe.com/go/getflashplayer">

<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />

</a>

</div>

<h2 style=" font-family:Verdana, Arial, Helvetica, sans-serif; font-size:15px">ВТ1-07</h2>

</center>

</body>

</html>