getTime – Our First Utility Web Service

getTime is a handy service for building AJAX applications and learning how to work with XML and web services. When called, getTime returns the current time on the Yahoo! server, in your choice of XML, serialized PHP, or JSON.

The first application using getTime is the countdown timer on We're using the serialized PHP result, unserialze it and pull the value out of the array.

$timeUrl = "";
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $timeUrl );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
$result = curl_exec($ch);
$result = unserialize($result);
$timestamp = $result['Result']['Timestamp'];

Yes, this may be overkill ... :)

Dan Theurer