As a continuation from my last post, here's how you get a feed.
<?
// Note: this function assumes secure=0 AuthSub tokens
function getFeed($feedUri, $sessionToken) {
$curl = curl_init($feedUri);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type: application/atom+xml',
'Authorization: AuthSub token="' . trim($sessionToken) . '"'
));
$response = curl_exec($curl);
if (!$response) {
die('Error: ' . curl_error($curl) . "\n");
}
curl_close($curl);
return $response;
}
?>
No comments:
Post a Comment