SimpleXML PHP Calendar

snakeriver
snakeriver used Ask the Experts™
on
Hello,

I'm using simpleXML to connect to a Google calendar's xml feed and I can grab the title, date, summary etc just fine.  Does anybody know what element name I should use to create a link back to the even on Google side?  I thought the <id> element was the link, but that doesn't appear to be working.  Below is my code:
<?php
	
$feedURL = "http://www.google.com/calendar/feeds/me@gmail.com/public/basic?orderby=starttime";
$sxml = simplexml_load_file($feedURL);
 
?>
 
<?php
foreach ($sxml->entry as $entry) {
$title = stripslashes($entry->title);
$link = stripslashes($entry->id);
$summary = stripslashes($entry->summary);
?>
	
        <!--EDIT HTML HERE-->
        <h3 class="event-title"><a href="<?= $link ?>"><?= $title ?></a></h3>
        <p><strong><?= $pubdate ?></strong><br />
        <?= $summary ?></p>
 
<?php } ?>

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2011
Top Expert 2016

Commented:
Look inside the object by adding this line after line 4

echo"<pre>\n"; var_dump($sxml); echo "</pre>\n";

See if you can find the information you want in there.  If not, it may not be available from the way you are calling Google.

HTH, ~Ray

Author

Commented:
The var_dump is here: http://www.valewineco.com/includes/test.php

The first entry's URL that I need is:
http://www.google.com/calendar/event?eid=bmNobHNjaDBqY2NydHJpaGs4czJyMWZmbTQgdmFsZXdpbmVjb0Bt

Any idea how to get that value using SimpleXML?

Thanks!

Most Valuable Expert 2011
Top Expert 2016

Commented:
Yes, it is in there, for sure, so we can get it.  Please do this and post the output in the code snippet.  Then I can show you how to get the information out of the XML.

Best, ~Ray
<?php 
// MODIFY THIS LINE TO GET LIVE DATA
$feedURL = "http://www.google.com/calendar/feeds/me@gmail.com/public/basic?orderby=starttime";
 
$thing = file_get_contents($feedURL);
echo htmlentities($thing);

Open in new window

Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:

<?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:gml='http://www.opengis.net/gml' xmlns:georss='http://www.georss.org/georss' xmlns:batch='http://schemas.google.com/gdata/batch' xmlns:gCal='http://schemas.google.com/gCal/2005' xmlns:gd='http://schemas.google.com/g/2005'><id>http://www.google.com/calendar/feeds/valewineco%40gmail.com/public/basic</id><updated>2009-07-21T16:13:24.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/><title type='text'>Vale Wine Company</title><subtitle type='text'>Vale Wine Company</subtitle><link rel='alternate' type='text/html' href='http://www.google.com/calendar/embed?src=valewineco@gmail.com'/><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.google.com/calendar/feeds/valewineco%40gmail.com/public/basic'/><link rel='http://schemas.google.com/g/2005#batch' type='application/atom+xml' href='http://www.google.com/calendar/feeds/valewineco%40gmail.com/public/basic/batch'/><link rel='self' type='application/atom+xml' href='http://www.google.com/calendar/feeds/valewineco%40gmail.com/public/basic?max-results=25&amp;orderby=starttime'/><author><name>John Danielson</name><email>valewineco@gmail.com</email></author><generator version='1.0' uri='http://www.google.com/calendar'>Google Calendar</generator><openSearch:totalResults>12</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><gCal:timezone value='America/Denver'/><gCal:timesCleaned value='0'/><entry><id>http://www.google.com/calendar/feeds/valewineco%40gmail.com/public/basic/nchlsch0jccrtrihk8s2r1ffm4</id><published>2009-06-25T23:34:08.000Z</published><updated>2009-06-25T23:34:11.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/><title type='html'>Barrel Tasting at the winery</title><summary type='html'>When: Sat Nov 28, 2009 10am to 2pm&amp;nbsp; MST&lt;br&gt; &lt;br&gt;Where: the winery &lt;br&gt;Event Status: confirmed</summary><content type='html'>When: Sat Nov 28, 2009 10am to 2pm  MST&lt;br /&gt; &lt;br /&gt;Where: the winery &lt;br /&gt;Event Status: confirmed</content><link rel='alternate' type='text/html' href='http://www.google.com/calendar/event?eid=bmNobHNjaDBqY2NydHJpaGs4czJyMWZmbTQgdmFsZXdpbmVjb0Bt' title='alternate'/><link rel='self' type='application/atom+xml' href='http://www.google.com/calendar/feeds/valewineco%40gmail.com/public/basic/nchlsch0jccrtrihk8s2r1ffm4'/><author><name>John Danielson</name><email>valewineco@gmail.com</email></author></entry><entry><id>http://www.google.com/calendar/feeds/valewineco%40gmail.com/public/basic/kjnq88anbptugmh76329rhg44k</id><published>2009-06-25T23:33:49.000Z</published><updated>2009-06-25T23:33:53.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/><title type='html'>Barrel Tasting at the winery</title><summary type='html'>When: Fri Nov 27, 2009 10am to 2pm&amp;nbsp; MST&lt;br&gt; &lt;br&gt;Where: the winery &lt;br&gt;Event Status: confirmed</summary><content type='html'>When: Fri Nov 27, 2009 10am to 2pm  MST&lt;br /&gt; &lt;br /&gt;Where: the winery &lt;br /&gt;Event Status: confirmed</content><link rel='alternate' type='text/html' href='http://www.google.com/calendar/event?eid=a2pucTg4YW5icHR1Z21oNzYzMjlyaGc0NGsgdmFsZXdpbmVjb0Bt' title='alternate'/><link rel='self' type='application/atom+xml' href='http://www.google.com/calendar/feeds/valewineco%40gmail.com/public/basic/kjnq88anbptugmh76329rhg44k'/><author><name>John Danielson</name><email>valewineco@gmail.com</email></author></entry><entry><id>http://www.google.com/calendar/feeds/valewineco%40gmail.com/public/basic/kq5jbghqnmsiepee5e5v8rb880</id><published>2009-07-07T22:28:19.000Z</published><updated>2009-07-07T22:28:19.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/><title type='html'>Wine Tasting at Eagle Wine Festival</title><summary type='html'>When: Sat Aug 22, 2009 12pm to 5pm&amp;nbsp; MDT&lt;br&gt; &lt;br&gt;Where: Eagle Wine Festival &lt;br&gt;Event Status: confirmed</summary><content type='html'>When: Sat Aug 22, 2009 12pm to 5pm  MDT&lt;br /&gt; &lt;br /&gt;Where: Eagle Wine Festival &lt;br /&gt;Event Status: confirmed</content><link rel='alternate' type='text/html' href='http://www.google.com/calendar/event?eid=a3E1amJnaHFubXNpZXBlZTVlNXY4cmI4ODAgdmFsZXdpbmVjb0Bt' title='alternate'/><link rel='self' type='application/atom+xml' href='http://www.google.com/calendar/feeds/valewineco%40gmail.com/public/basic/kq5jbghqnmsiepee5e5v8rb880'/><author><name>John Danielson</name><email>valewineco@gmail.com</email></author></entry><entry><id>http://www.google.com/calendar/feeds/valewineco%40gmail.com/public/basic/mvor8c1c8gacnkkjp5fnu2e0l0</id><published>2009-06-25T23:33:04.000Z</published><updated>2009-06-25T23:33:09.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/><title type='html'>Boise Young Professionals at the winery</title><summary type='html'>When: Sat Aug 22, 2009 11am to 2pm&amp;nbsp; MDT&lt;br&gt; &lt;br&gt;Where: the winery &lt;br&gt;Event Status: confirmed</summary><content type='html'>When: Sat Aug 22, 2009 11am to 2pm  MDT&lt;br /&gt; &lt;br /&gt;Where: the winery &lt;br /&gt;Event Status: confirmed</content><link rel='alternate' type='text/html' href='http://www.google.com/calendar/event?eid=bXZvcjhjMWM4Z2FjbmtranA1Zm51MmUwbDAgdmFsZXdpbmVjb0Bt' title='alternate'/><link rel='self' type='application/atom+xml' href='http://www.google.com/calendar/feeds/valewineco%40gmail.com/public/basic/mvor8c1c8gacnkkjp5fnu2e0l0'/><author><name>John Danielson</name><email>valewineco@gmail.com</email></author></entry><entry><id>http://www.google.com/calendar/feeds/valewineco%40gmail.com/public/basic/5evkvo8gm9t97ebt5d23e4d2l4</id><published>2009-06-25T23:32:38.000Z</published><updated>2009-06-25T23:32:42.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/><title type='html'>Eagle Food &amp;amp; Wine Festival</title><summary type='html'>When: Fri Aug 21, 2009 10am to 2pm&amp;nbsp; MDT&lt;br&gt; &lt;br&gt;Event Status: confirmed</summary><content type='html'>When: Fri Aug 21, 2009 10am to 2pm  MDT&lt;br /&gt; &lt;br /&gt;Event Status: confirmed</content><link rel='alternate' type='text/html' href='http://www.google.com/calendar/event?eid=NWV2a3ZvOGdtOXQ5N2VidDVkMjNlNGQybDQgdmFsZXdpbmVjb0Bt' title='alternate'/><link rel='self' type='application/atom+xml' href='http://www.google.com/calendar/feeds/valewineco%40gmail.com/public/basic/5evkvo8gm9t97ebt5d23e4d2l4'/><author><name>John Danielson</name><email>valewineco@gmail.com</email></author></entry><entry><id>http://www.google.com/calendar/feeds/valewineco%40gmail.com/public/basic/jruhg4lee1lucv4533d8tpf1lo</id><published>2009-06-25T23:29:39.000Z</published><updated>2009-06-25T23:29:46.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/><title type='html'>Tasting at the winery</title><summary type='html'>When: Sat Aug 15, 2009 11am to 4:30pm&amp;nbsp; MDT&lt;br&gt; &lt;br&gt;Where: the winery &lt;br&gt;Event Status: confirmed</summary><content type='html'>When: Sat Aug 15, 2009 11am to 4:30pm  MDT&lt;br /&gt; &lt;br /&gt;Where: the winery &lt;br /&gt;Event Status: confirmed</content><link rel='alternate' type='text/html' href='http://www.google.com/calendar/event?eid=anJ1aGc0bGVlMWx1Y3Y0NTMzZDh0cGYxbG8gdmFsZXdpbmVjb0Bt' title='alternate'/><link rel='self' type='application/atom+xml' href='http://www.google.com/calendar/feeds/valewineco%40gmail.com/public/basic/jruhg4lee1lucv4533d8tpf1lo'/><author><name>John Danielson</name><email>valewineco@gmail.com</email></author></entry><entry><id>http://www.google.com/calendar/feeds/valewineco%40gmail.com/public/basic/mc9l9m0ikm0dsqfmbd59g33ffo</id><published>2009-06-25T23:29:11.000Z</published><updated>2009-06-25T23:29:18.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/><title type='html'>Idaho Wine Society Dinner at the winery</title><summary type='html'>When: Wed Aug 12, 2009 6pm to 9pm&amp;nbsp; MDT&lt;br&gt; &lt;br&gt;Where: the winery &lt;br&gt;Event Status: confirmed</summary><content type='html'>When: Wed Aug 12, 2009 6pm to 9pm  MDT&lt;br /&gt; &lt;br /&gt;Where: the winery &lt;br /&gt;Event Status: confirmed</content><link rel='alternate' type='text/html' href='http://www.google.com/calendar/event?eid=bWM5bDltMGlrbTBkc3FmbWJkNTlnMzNmZm8gdmFsZXdpbmVjb0Bt' title='alternate'/><link rel='self' type='application/atom+xml' href='http://www.google.com/calendar/feeds/valewineco%40gmail.com/public/basic/mc9l9m0ikm0dsqfmbd59g33ffo'/><author><name>John Danielson</name><email>valewineco@gmail.com</email></author></entry><entry><id>http://www.google.com/calendar/feeds/valewineco%40gmail.com/public/basic/ijb8i72v1h5soor9drvkm5c5es</id><published>2009-07-07T22:26:57.000Z</published><updated>2009-07-16T16:19:55.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/><title type='html'>Wine Tasting at the Boise Co-op Wine Shop</title><summary type='html'>When: Sat Jul 25, 2009 2pm to 5pm&amp;nbsp; MDT&lt;br&gt; &lt;br&gt;Where: Boise Co-op Wine Shop &lt;br&gt;Event Status: confirmed</summary><content type='html'>When: Sat Jul 25, 2009 2pm to 5pm  MDT&lt;br /&gt; &lt;br /&gt;Where: Boise Co-op Wine Shop &lt;br /&gt;Event Status: confirmed &lt;br /&gt;Event Description: 915 N. 8th Street, Boise, ID 83702 208-472-4519</content><link rel='alternate' type='text/html' href='http://www.google.com/calendar/event?eid=aWpiOGk3MnYxaDVzb29yOWRydmttNWM1ZXMgdmFsZXdpbmVjb0Bt' title='alternate'/><link rel='self' type='application/atom+xml' href='http://www.google.com/calendar/feeds/valewineco%40gmail.com/public/basic/ijb8i72v1h5soor9drvkm5c5es'/><author><name>John Danielson</name><email>valewineco@gmail.com</email></author></entry><entry><id>http://www.google.com/calendar/feeds/valewineco%40gmail.com/public/basic/cjat3f0bmv2tlcl5f7n8rcvq50</id><published>2009-07-07T22:25:46.000Z</published><updated>2009-07-21T15:06:50.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/><title type='html'>Wine Tasting / Jazz Night at Season's Bistro</title><summary type='html'>When: Tue Jul 21, 2009 6pm to 8pm&amp;nbsp; MDT&lt;br&gt; &lt;br&gt;Where: Season&amp;#39;s Bistro &lt;br&gt;Event Status: confirmed</summary><content type='html'>When: Tue Jul 21, 2009 6pm to 8pm  MDT&lt;br /&gt; &lt;br /&gt;Where: Season&amp;#39;s Bistro &lt;br /&gt;Event Status: confirmed &lt;br /&gt;Event Description: 1117 Winding Creek Drive, Suite 150, Eagle, ID 83616 208-939-6680</content><link rel='alternate' type='text/html' href='http://www.google.com/calendar/event?eid=Y2phdDNmMGJtdjJ0bGNsNWY3bjhyY3ZxNTAgdmFsZXdpbmVjb0Bt' title='alternate'/><link rel='self' type='application/atom+xml' href='http://www.google.com/calendar/feeds/valewineco%40gmail.com/public/basic/cjat3f0bmv2tlcl5f7n8rcvq50'/><author><name>John Danielson</name><email>valewineco@gmail.com</email></author></entry><entry><id>http://www.google.com/calendar/feeds/valewineco%40gmail.com/public/basic/0rv1kcl58bk3jr89ci28g26beo</id><published>2009-07-07T22:19:56.000Z</published><updated>2009-07-16T16:17:38.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/><title type='html'>Winemaker's Dinner at Orchard House Restaurant</title><summary type='html'>When: Thu Jul 16, 2009 6:30pm to 8:30pm&amp;nbsp; MDT&lt;br&gt; &lt;br&gt;Where: Orchard House Restaurant &lt;br&gt;Event Status: confirmed</summary><content type='html'>When: Thu Jul 16, 2009 6:30pm to 8:30pm  MDT&lt;br /&gt; &lt;br /&gt;Where: Orchard House Restaurant &lt;br /&gt;Event Status: confirmed &lt;br /&gt;Event Description: 14949 Sunnyslope Road, Caldwell, ID 83607 208-459-8200 Please call Orchard House for reservations</content><link rel='alternate' type='text/html' href='http://www.google.com/calendar/event?eid=MHJ2MWtjbDU4YmszanI4OWNpMjhnMjZiZW8gdmFsZXdpbmVjb0Bt' title='alternate'/><link rel='self' type='application/atom+xml' href='http://www.google.com/calendar/feeds/valewineco%40gmail.com/public/basic/0rv1kcl58bk3jr89ci28g26beo'/><author><name>John Danielson</name><email>valewineco@gmail.com</email></author></entry><entry><id>http://www.google.com/calendar/feeds/valewineco%40gmail.com/public/basic/6cc0q6tct9d4jsj4hib0e0cd9s</id><published>2009-07-07T22:17:44.000Z</published><updated>2009-07-07T22:17:44.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/><title type='html'>Wine Tasting at Music of the Vine, Caldwell</title><summary type='html'>When: Tue Jul 14, 2009 6pm to 8pm&amp;nbsp; MDT&lt;br&gt; &lt;br&gt;Where: Music of the Vine, Caldwell, ID &lt;br&gt;Event Status: confirmed</summary><content type='html'>When: Tue Jul 14, 2009 6pm to 8pm  MDT&lt;br /&gt; &lt;br /&gt;Where: Music of the Vine, Caldwell, ID &lt;br /&gt;Event Status: confirmed</content><link rel='alternate' type='text/html' href='http://www.google.com/calendar/event?eid=NmNjMHE2dGN0OWQ0anNqNGhpYjBlMGNkOXMgdmFsZXdpbmVjb0Bt' title='alternate'/><link rel='self' type='application/atom+xml' href='http://www.google.com/calendar/feeds/valewineco%40gmail.com/public/basic/6cc0q6tct9d4jsj4hib0e0cd9s'/><author><name>John Danielson</name><email>valewineco@gmail.com</email></author></entry><entry><id>http://www.google.com/calendar/feeds/valewineco%40gmail.com/public/basic/jp36mcqtdio77oq7a85nlcjrvs</id><published>2009-07-07T22:16:30.000Z</published><updated>2009-07-16T16:15:51.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/><title type='html'>Wine Tastings at Urban Winemakers Cooperative</title><summary type='html'>Recurring Event&lt;br&gt; First start: 2009-07-11 12:00:00 MDT &lt;br&gt; Duration: 18000 &lt;br&gt;Where: Urban Winemakers Cooperative &lt;br&gt;Event Status: confirmed</summary><content type='html'>Recurring Event&lt;br /&gt; First start: 2009-07-11 12:00:00 MDT &lt;br /&gt; Duration: 18000 &lt;br /&gt;Where: Urban Winemakers Cooperative &lt;br /&gt;Event Status: confirmed &lt;br /&gt;Event Description: Every Saturday at the Urban Winemakers Cooperative 107 E. 44th St., Garden City, ID 83714 208-376-4023</content><link rel='alternate' type='text/html' href='http://www.google.com/calendar/event?eid=anAzNm1jcXRkaW83N29xN2E4NW5sY2pydnNfMjAwOTA3MTFUMTgwMDAwWiB2YWxld2luZWNvQG0' title='alternate'/><link rel='self' type='application/atom+xml' href='http://www.google.com/calendar/feeds/valewineco%40gmail.com/public/basic/jp36mcqtdio77oq7a85nlcjrvs'/><author><name>John Danielson</name><email>valewineco@gmail.com</email></author></entry></feed>

Open in new window

Most Valuable Expert 2011
Top Expert 2016

Commented:
Thanks, I'll take a look at it.
Most Valuable Expert 2011
Top Expert 2016
Commented:
See line 26.  You can install this and run it.  You might try marrying it up with your original code, so it is getting the "live" data from Google.  Please let me know if you have any questions. ~Ray
<?php // RAY_temp_snakeriver.php
error_reporting(E_ALL);
 
// TEST DATA
$xml = "<?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:gml='http://www.opengis.net/gml' xmlns:georss='http://www.georss.org/georss' xmlns:batch='http://schemas.google.com/gdata/batch' xmlns:gCal='http://schemas.google.com/gCal/2005' xmlns:gd='http://schemas.google.com/g/2005'><id>http://www.google.com/calendar/feeds/valewineco@gmail.com/public/basic</id><updated>2009-07-21T16:13:24.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/><title type='text'>Vale Wine Company</title><subtitle type='text'>Vale Wine Company</subtitle><link rel='alternate' type='text/html' href='http://www.google.com/calendar/embed?src=valewineco@gmail.com'/><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.google.com/calendar/feeds/valewineco@gmail.com/public/basic'/><link rel='http://schemas.google.com/g/2005#batch' type='application/atom+xml' href='http://www.google.com/calendar/feeds/valewineco@gmail.com/public/basic/batch'/><link rel='self' type='application/atom+xml' href='http://www.google.com/calendar/feeds/valewineco@gmail.com/public/basic?max-results=25&amp;orderby=starttime'/><author><name>John Danielson</name><email>valewineco@gmail.com</email></author><generator version='1.0' uri='http://www.google.com/calendar'>Google Calendar</generator><openSearch:totalResults>12</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><gCal:timezone value='America/Denver'/><gCal:timesCleaned value='0'/><entry><id>http://www.google.com/calendar/feeds/valewineco@gmail.com/public/basic/nchlsch0jccrtrihk8s2r1ffm4</id><published>2009-06-25T23:34:08.000Z</published><updated>2009-06-25T23:34:11.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/><title type='html'>Barrel Tasting at the winery</title><summary type='html'>When: Sat Nov 28, 2009 10am to 2pm&amp;nbsp; MST&lt;br&gt; &lt;br&gt;Where: the winery &lt;br&gt;Event Status: confirmed</summary><content type='html'>When: Sat Nov 28, 2009 10am to 2pm  MST&lt;br /&gt; &lt;br /&gt;Where: the winery &lt;br /&gt;Event Status: confirmed</content><link rel='alternate' type='text/html' href='http://www.google.com/calendar/event?eid=bmNobHNjaDBqY2NydHJpaGs4czJyMWZmbTQgdmFsZXdpbmVjb0Bt' title='alternate'/><link rel='self' type='application/atom+xml' href='http://www.google.com/calendar/feeds/valewineco@gmail.com/public/basic/nchlsch0jccrtrihk8s2r1ffm4'/><author><name>John Danielson</name><email>valewineco@gmail.com</email></author></entry><entry><id>http://www.google.com/calendar/feeds/valewineco@gmail.com/public/basic/kjnq88anbptugmh76329rhg44k</id><published>2009-06-25T23:33:49.000Z</published><updated>2009-06-25T23:33:53.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/><title type='html'>Barrel Tasting at the winery</title><summary type='html'>When: Fri Nov 27, 2009 10am to 2pm&amp;nbsp; MST&lt;br&gt; &lt;br&gt;Where: the winery &lt;br&gt;Event Status: confirmed</summary><content type='html'>When: Fri Nov 27, 2009 10am to 2pm  MST&lt;br /&gt; &lt;br /&gt;Where: the winery &lt;br /&gt;Event Status: confirmed</content><link rel='alternate' type='text/html' href='http://www.google.com/calendar/event?eid=a2pucTg4YW5icHR1Z21oNzYzMjlyaGc0NGsgdmFsZXdpbmVjb0Bt' title='alternate'/><link rel='self' type='application/atom+xml' href='http://www.google.com/calendar/feeds/valewineco@gmail.com/public/basic/kjnq88anbptugmh76329rhg44k'/><author><name>John Danielson</name><email>valewineco@gmail.com</email></author></entry><entry><id>http://www.google.com/calendar/feeds/valewineco@gmail.com/public/basic/kq5jbghqnmsiepee5e5v8rb880</id><published>2009-07-07T22:28:19.000Z</published><updated>2009-07-07T22:28:19.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/><title type='html'>Wine Tasting at Eagle Wine Festival</title><summary type='html'>When: Sat Aug 22, 2009 12pm to 5pm&amp;nbsp; MDT&lt;br&gt; &lt;br&gt;Where: Eagle Wine Festival &lt;br&gt;Event Status: confirmed</summary><content type='html'>When: Sat Aug 22, 2009 12pm to 5pm  MDT&lt;br /&gt; &lt;br /&gt;Where: Eagle Wine Festival &lt;br /&gt;Event Status: confirmed</content><link rel='alternate' type='text/html' href='http://www.google.com/calendar/event?eid=a3E1amJnaHFubXNpZXBlZTVlNXY4cmI4ODAgdmFsZXdpbmVjb0Bt' title='alternate'/><link rel='self' type='application/atom+xml' href='http://www.google.com/calendar/feeds/valewineco@gmail.com/public/basic/kq5jbghqnmsiepee5e5v8rb880'/><author><name>John Danielson</name><email>valewineco@gmail.com</email></author></entry><entry><id>http://www.google.com/calendar/feeds/valewineco@gmail.com/public/basic/mvor8c1c8gacnkkjp5fnu2e0l0</id><published>2009-06-25T23:33:04.000Z</published><updated>2009-06-25T23:33:09.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/><title type='html'>Boise Young Professionals at the winery</title><summary type='html'>When: Sat Aug 22, 2009 11am to 2pm&amp;nbsp; MDT&lt;br&gt; &lt;br&gt;Where: the winery &lt;br&gt;Event Status: confirmed</summary><content type='html'>When: Sat Aug 22, 2009 11am to 2pm  MDT&lt;br /&gt; &lt;br /&gt;Where: the winery &lt;br /&gt;Event Status: confirmed</content><link rel='alternate' type='text/html' href='http://www.google.com/calendar/event?eid=bXZvcjhjMWM4Z2FjbmtranA1Zm51MmUwbDAgdmFsZXdpbmVjb0Bt' title='alternate'/><link rel='self' type='application/atom+xml' href='http://www.google.com/calendar/feeds/valewineco@gmail.com/public/basic/mvor8c1c8gacnkkjp5fnu2e0l0'/><author><name>John Danielson</name><email>valewineco@gmail.com</email></author></entry><entry><id>http://www.google.com/calendar/feeds/valewineco@gmail.com/public/basic/5evkvo8gm9t97ebt5d23e4d2l4</id><published>2009-06-25T23:32:38.000Z</published><updated>2009-06-25T23:32:42.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/><title type='html'>Eagle Food &amp;amp; Wine Festival</title><summary type='html'>When: Fri Aug 21, 2009 10am to 2pm&amp;nbsp; MDT&lt;br&gt; &lt;br&gt;Event Status: confirmed</summary><content type='html'>When: Fri Aug 21, 2009 10am to 2pm  MDT&lt;br /&gt; &lt;br /&gt;Event Status: confirmed</content><link rel='alternate' type='text/html' href='http://www.google.com/calendar/event?eid=NWV2a3ZvOGdtOXQ5N2VidDVkMjNlNGQybDQgdmFsZXdpbmVjb0Bt' title='alternate'/><link rel='self' type='application/atom+xml' href='http://www.google.com/calendar/feeds/valewineco@gmail.com/public/basic/5evkvo8gm9t97ebt5d23e4d2l4'/><author><name>John Danielson</name><email>valewineco@gmail.com</email></author></entry><entry><id>http://www.google.com/calendar/feeds/valewineco@gmail.com/public/basic/jruhg4lee1lucv4533d8tpf1lo</id><published>2009-06-25T23:29:39.000Z</published><updated>2009-06-25T23:29:46.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/><title type='html'>Tasting at the winery</title><summary type='html'>When: Sat Aug 15, 2009 11am to 4:30pm&amp;nbsp; MDT&lt;br&gt; &lt;br&gt;Where: the winery &lt;br&gt;Event Status: confirmed</summary><content type='html'>When: Sat Aug 15, 2009 11am to 4:30pm  MDT&lt;br /&gt; &lt;br /&gt;Where: the winery &lt;br /&gt;Event Status: confirmed</content><link rel='alternate' type='text/html' href='http://www.google.com/calendar/event?eid=anJ1aGc0bGVlMWx1Y3Y0NTMzZDh0cGYxbG8gdmFsZXdpbmVjb0Bt' title='alternate'/><link rel='self' type='application/atom+xml' href='http://www.google.com/calendar/feeds/valewineco@gmail.com/public/basic/jruhg4lee1lucv4533d8tpf1lo'/><author><name>John Danielson</name><email>valewineco@gmail.com</email></author></entry><entry><id>http://www.google.com/calendar/feeds/valewineco@gmail.com/public/basic/mc9l9m0ikm0dsqfmbd59g33ffo</id><published>2009-06-25T23:29:11.000Z</published><updated>2009-06-25T23:29:18.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/><title type='html'>Idaho Wine Society Dinner at the winery</title><summary type='html'>When: Wed Aug 12, 2009 6pm to 9pm&amp;nbsp; MDT&lt;br&gt; &lt;br&gt;Where: the winery &lt;br&gt;Event Status: confirmed</summary><content type='html'>When: Wed Aug 12, 2009 6pm to 9pm  MDT&lt;br /&gt; &lt;br /&gt;Where: the winery &lt;br /&gt;Event Status: confirmed</content><link rel='alternate' type='text/html' href='http://www.google.com/calendar/event?eid=bWM5bDltMGlrbTBkc3FmbWJkNTlnMzNmZm8gdmFsZXdpbmVjb0Bt' title='alternate'/><link rel='self' type='application/atom+xml' href='http://www.google.com/calendar/feeds/valewineco@gmail.com/public/basic/mc9l9m0ikm0dsqfmbd59g33ffo'/><author><name>John Danielson</name><email>valewineco@gmail.com</email></author></entry><entry><id>http://www.google.com/calendar/feeds/valewineco@gmail.com/public/basic/ijb8i72v1h5soor9drvkm5c5es</id><published>2009-07-07T22:26:57.000Z</published><updated>2009-07-16T16:19:55.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/><title type='html'>Wine Tasting at the Boise Co-op Wine Shop</title><summary type='html'>When: Sat Jul 25, 2009 2pm to 5pm&amp;nbsp; MDT&lt;br&gt; &lt;br&gt;Where: Boise Co-op Wine Shop &lt;br&gt;Event Status: confirmed</summary><content type='html'>When: Sat Jul 25, 2009 2pm to 5pm  MDT&lt;br /&gt; &lt;br /&gt;Where: Boise Co-op Wine Shop &lt;br /&gt;Event Status: confirmed &lt;br /&gt;Event Description: 915 N. 8th Street, Boise, ID 83702 208-472-4519</content><link rel='alternate' type='text/html' href='http://www.google.com/calendar/event?eid=aWpiOGk3MnYxaDVzb29yOWRydmttNWM1ZXMgdmFsZXdpbmVjb0Bt' title='alternate'/><link rel='self' type='application/atom+xml' href='http://www.google.com/calendar/feeds/valewineco@gmail.com/public/basic/ijb8i72v1h5soor9drvkm5c5es'/><author><name>John Danielson</name><email>valewineco@gmail.com</email></author></entry><entry><id>http://www.google.com/calendar/feeds/valewineco@gmail.com/public/basic/cjat3f0bmv2tlcl5f7n8rcvq50</id><published>2009-07-07T22:25:46.000Z</published><updated>2009-07-21T15:06:50.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/><title type='html'>Wine Tasting / Jazz Night at Season's Bistro</title><summary type='html'>When: Tue Jul 21, 2009 6pm to 8pm&amp;nbsp; MDT&lt;br&gt; &lt;br&gt;Where: Season&amp;#39;s Bistro &lt;br&gt;Event Status: confirmed</summary><content type='html'>When: Tue Jul 21, 2009 6pm to 8pm  MDT&lt;br /&gt; &lt;br /&gt;Where: Season&amp;#39;s Bistro &lt;br /&gt;Event Status: confirmed &lt;br /&gt;Event Description: 1117 Winding Creek Drive, Suite 150, Eagle, ID 83616 208-939-6680</content><link rel='alternate' type='text/html' href='http://www.google.com/calendar/event?eid=Y2phdDNmMGJtdjJ0bGNsNWY3bjhyY3ZxNTAgdmFsZXdpbmVjb0Bt' title='alternate'/><link rel='self' type='application/atom+xml' href='http://www.google.com/calendar/feeds/valewineco@gmail.com/public/basic/cjat3f0bmv2tlcl5f7n8rcvq50'/><author><name>John Danielson</name><email>valewineco@gmail.com</email></author></entry><entry><id>http://www.google.com/calendar/feeds/valewineco@gmail.com/public/basic/0rv1kcl58bk3jr89ci28g26beo</id><published>2009-07-07T22:19:56.000Z</published><updated>2009-07-16T16:17:38.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/><title type='html'>Winemaker's Dinner at Orchard House Restaurant</title><summary type='html'>When: Thu Jul 16, 2009 6:30pm to 8:30pm&amp;nbsp; MDT&lt;br&gt; &lt;br&gt;Where: Orchard House Restaurant &lt;br&gt;Event Status: confirmed</summary><content type='html'>When: Thu Jul 16, 2009 6:30pm to 8:30pm  MDT&lt;br /&gt; &lt;br /&gt;Where: Orchard House Restaurant &lt;br /&gt;Event Status: confirmed &lt;br /&gt;Event Description: 14949 Sunnyslope Road, Caldwell, ID 83607 208-459-8200 Please call Orchard House for reservations</content><link rel='alternate' type='text/html' href='http://www.google.com/calendar/event?eid=MHJ2MWtjbDU4YmszanI4OWNpMjhnMjZiZW8gdmFsZXdpbmVjb0Bt' title='alternate'/><link rel='self' type='application/atom+xml' href='http://www.google.com/calendar/feeds/valewineco@gmail.com/public/basic/0rv1kcl58bk3jr89ci28g26beo'/><author><name>John Danielson</name><email>valewineco@gmail.com</email></author></entry><entry><id>http://www.google.com/calendar/feeds/valewineco@gmail.com/public/basic/6cc0q6tct9d4jsj4hib0e0cd9s</id><published>2009-07-07T22:17:44.000Z</published><updated>2009-07-07T22:17:44.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/><title type='html'>Wine Tasting at Music of the Vine, Caldwell</title><summary type='html'>When: Tue Jul 14, 2009 6pm to 8pm&amp;nbsp; MDT&lt;br&gt; &lt;br&gt;Where: Music of the Vine, Caldwell, ID &lt;br&gt;Event Status: confirmed</summary><content type='html'>When: Tue Jul 14, 2009 6pm to 8pm  MDT&lt;br /&gt; &lt;br /&gt;Where: Music of the Vine, Caldwell, ID &lt;br /&gt;Event Status: confirmed</content><link rel='alternate' type='text/html' href='http://www.google.com/calendar/event?eid=NmNjMHE2dGN0OWQ0anNqNGhpYjBlMGNkOXMgdmFsZXdpbmVjb0Bt' title='alternate'/><link rel='self' type='application/atom+xml' href='http://www.google.com/calendar/feeds/valewineco@gmail.com/public/basic/6cc0q6tct9d4jsj4hib0e0cd9s'/><author><name>John Danielson</name><email>valewineco@gmail.com</email></author></entry><entry><id>http://www.google.com/calendar/feeds/valewineco@gmail.com/public/basic/jp36mcqtdio77oq7a85nlcjrvs</id><published>2009-07-07T22:16:30.000Z</published><updated>2009-07-16T16:15:51.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/><title type='html'>Wine Tastings at Urban Winemakers Cooperative</title><summary type='html'>Recurring Event&lt;br&gt; First start: 2009-07-11 12:00:00 MDT &lt;br&gt; Duration: 18000 &lt;br&gt;Where: Urban Winemakers Cooperative &lt;br&gt;Event Status: confirmed</summary><content type='html'>Recurring Event&lt;br /&gt; First start: 2009-07-11 12:00:00 MDT &lt;br /&gt; Duration: 18000 &lt;br /&gt;Where: Urban Winemakers Cooperative &lt;br /&gt;Event Status: confirmed &lt;br /&gt;Event Description: Every Saturday at the Urban Winemakers Cooperative 107 E. 44th St., Garden City, ID 83714 208-376-4023</content><link rel='alternate' type='text/html' href='http://www.google.com/calendar/event?eid=anAzNm1jcXRkaW83N29xN2E4NW5sY2pydnNfMjAwOTA3MTFUMTgwMDAwWiB2YWxld2luZWNvQG0' title='alternate'/><link rel='self' type='application/atom+xml' href='http://www.google.com/calendar/feeds/valewineco@gmail.com/public/basic/jp36mcqtdio77oq7a85nlcjrvs'/><author><name>John Danielson</name><email>valewineco@gmail.com</email></author></entry></feed>";
 
// THING WE WANT TO FIND
$dat = 'http://www.google.com/calendar/event?eid=bmNobHNjaDBqY2NydHJpaGs4czJyMWZmbTQgdmFsZXdpbmVjb0Bt';
 
// NOTE THAT THIS XML IS NOT VALID UTF-8 (PROBABLY BECAUSE OF HTMLENTITIES?)
$xml = str_replace(" encoding='UTF-8'?", " encoding='ISO-8859-1'?", $xml);
 
// FOR READABILITY OF THE TEST DATA
$xml = str_replace('>', ">\n", $xml);
// var_dump($xml);
 
// MAKE THE TEST DATA INTO AN OBJECT
$obj = SimpleXML_Load_String($xml);
// var_dump($obj);
 
// ITERATE OVER THE OBJECT TO EXTRACT USEFUL INFORMATION
foreach ($obj->entry as $thing)
{
    $title    = trim((string)$thing->title);
    $summary  = trim((string)$thing->summary);
    $linkhref = trim((string)$thing->link[0]["href"]);
 
    $my_link  = "[<a target=\"my_calendar_window\" href=\"$linkhref\">LINK</a>]\n";
 
    echo "<br/>$title $my_link\n";
    echo "<br/>$summary\n";
    echo "<br/>*************** END OF ENTRY ***************<br/>\n";
}

Open in new window

Author

Commented:
Thanks!
Most Valuable Expert 2011
Top Expert 2016

Commented:
Thanks for the points - glad I was able to help, ~Ray

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial