Category Archives: Tech

Listing Opportunities via XML

Today we’re going to talk about something a bit more techy than usual – because we have something exciting to announce: Opportunity data is now available from GoVoluntr in a XML feed! So what does this mean for those of you who are building web or mobile applications? Well it means you now have access to our database of volunteer opportunities in a format that you can use in your websites or applications. We’ve already been using this internally for building pages specific to zipcodes or certain organizations and now we’re ready to open it up to you.

We’re going to continue making more information available via XML and will be launching a guide on all the properties, but today I wanted to give you just a brief overview of how to begin using the feed to integrate into your projects. So, let’s create a page that pulls all the opportunities from a specific zipcode.

To get started, you may want to take a look at the raw feed. If you do this in a browser like Chrome or Safari, it could auto-format it for you too. The feed can be found at http://govoluntr.com/events.xml.

So, let’s import that feed into our file. I’m using php today, but really you could use any language you want.

   $opp = simplexml_load_file('https://govoluntr.com/events.xml');

Ok, so this line will pull the feed in and set it to a variable. Then we should put a simple foreach loop together that will go through each opportunity and pull out the details we want.

  foreach ($opp->VolunteerOpportunity as $event):
       $category=$event->Categories->Category->CategoryID;
     if ($zip=$event->Locations->Location->ZipOrPostalCode == 95134 || $zip=$event->Locations->Location->ZipOrPostalCode == 95110) {
         $id=$event->LocalID;
         $title=$event->Title;
         $address=$event->Locations->Location->Name;
          $zip=$event->Locations->Location->ZipOrPostalCode;
          $startdate=$event->OpportunityDates->StartDate;
          $enddate=$event->OpportunityDates->EndDate;
          $image=$event->LogoURL;
          $url=$event->DetailURL;
?>

Now you should also note that I am checking for certain zip codes before pulling the data. It’s this line right here:

if ($zip=$event->Locations->Location->ZipOrPostalCode == 95134 || $zip=$event->Locations->Location->ZipOrPostalCode == 94301)

You can of course filter by any of the properties and can have multiple if you wish as shown in this example. Great, so we’ve got the information parsed from the feed, now we just need to display it. You can, of course, display it in any format you’d like, but it would look something like this:

<div>
   <?php echo $startdate;
      if ($enddate != "") {
         echo " to " . $enddate;
   } ?>
</div>

Then, once you’ve set up the display for each opportunity, be sure to end your foreach loop.

endforeach; ?>

That’s it! Take a look at the feed to see what information is available and leave a comment below if you have any questions or requests for other data you want to see available through XML.

Keep doing good!

Kevin

 

Geckoboard, PHP, and MySQL

The GoVoluntr office is always buzzing – lots of new and exciting things are always happening. One of the latest projects we are just starting is GoVoluntr v2. We are very excited about it, refining the GoVoluntr process even more to make it the easiest platform to volunteer, earn rewards, track social responsibility and more! Although it is many months away, it inspired us to start a new series called ‘Tech of GoVoluntr’. In this much more geeky series, you’ll get a sneak peak into the technologies and processes that help GoVoluntr run. So, let’s kick it off with metrics.

Continue reading

Beta Launch Tech Update

Thank You! Thank you to everyone who took the time on Saturday to signup for GoVoluntr and retweet it or re-share it. We cannot thank you enough.

We also have to say sorry.  As you probably know, Young and I had been working on GoVoluntr for quite a while.  At the time of launch, we had been going just about 30 hours straight – we were exhausted! But, we wanted to get GoVoluntr into the hands of our users.

Continue reading