Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   FIRST-related Organizations (http://www.chiefdelphi.com/forums/forumdisplay.php?f=61)
-   -   FIRST Blogs API (http://www.chiefdelphi.com/forums/showthread.php?t=39060)

Timothy D. Ginn 23-07-2005 09:53

FIRST Blogs API
 
For those of you who don't know FIRST Blogs is an aggregation of public weblogs written by those affiliated with FIRST in some way (including alumni).

Anyway, I started to write an API for use by programmers who want to interface with the site; it's not fully developed and will probably increase from where it's at in the future (subscribe to this thread for updates).

Here's some sample code for interfacing with FIRST Blogs via the API:

PHP Code:

<?php

/*
 *  This is a demo client which connects to the FIRST Blogs
 *  API and retrieves a list of blogs with a given team number.
 *
 *  The docs for the PEAR XML_RPC are at:
 *    http://pear.php.net/manual/en/package.webservices.xml-rpc.php
 *
 *  Code originally written by Tim Ginn <tim@openfirst.org> - July 23, 2005
 */


// Include the PEAR XML_RPC Package
require_once 'XML/RPC.php';
require_once 
'XML/RPC/Server.php';

// Set and encode parameters for the query
//  First parameter: string containing the address to the homepage of your site
//              (or e-mail at which the author of a client may be contacted)
//  Second parameter: int containing the team number to lookup.
$params = array(new XML_RPC_Value('http://www.example.org''string'), new XML_RPC_Value(0'int'));
  
// Specify which function to use
$msg = new XML_RPC_Message('getbloginfobyteam'$params);

// Setup the connection to the FIRST Blogs server
$cli = new XML_RPC_Client('/api/''blog.openfirst.org');

// Debugging (uncomment to enable)
// $cli->setDebug(1);

// Query the FIRST Blogs server
$resp $cli->send($msg);

// Print out a response to the query
// (for most practical purposes you'd probably want to do something else)   
print_r($resp);

?>

Edit: I should probably also mention that team 0 is special in that it returns those who are no longer (or never were) affiliated with a particular team.


All times are GMT -5. The time now is 20:06.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi