February 18, 2009 by alvanweb
I used FeedBurner API in my last project (FeedRoll). I needed to know error number for abnormal feeds. FeedBurner API returns below error numbers:
1: Feed Not Found
2: This feed does not permit Awareness API access
5: Missing required parameter (URI)
6: Malformed parameter (DATES)
I used cURL (Client URL Library Functions) for Perform a cURL session and next Parsed XML via SimpleXML Class. But didn’t available data for feed that didn’t permit Awareness API access. Because cURL was Unauthorized.
In this case we can use HTTP code that corresponding to ‘http_code’ index of the array returned by curl_getinfo. I write below code for it:
< ?php
$twodayago = date('Y-m-d', strtotime('-2 days', time()));
$onedayago = date('Y-m-d', strtotime('-1 days', time()));
$today = date('Y-m-d');
$api = "https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=$feedid&dates=$twodayago,$onedayago";
//Initialize a cURL session
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $api);
$data = curl_exec($ch);
$base_code = curl_getinfo($ch);
curl_close($ch);
if ($base_code['http_code']=='401'){
$burner_count_circulation = 'This feed does not permit Awareness API access';
$burner_date = $today;
} else {
$xml = new SimpleXMLElement($data); //Parse XML via SimpleXML Class
$bis = $xml->attributes(); //Bis Contain first attribute, It usually is ok or fail in FeedBurner
if ($bis=='ok'){
foreach ($xml->feed as $feed) {
if ($feed->entry[1]['circulation']=='0'){
$burner_count_circulation = $feed->entry[0]['circulation'];
$burner_date = $feed->entry[0]['date'];
} else {
$burner_count_circulation = $feed->entry[1]['circulation'];
$burner_date = $feed->entry[1]['date'];
}
}
}
if ($bis=='fail'){
switch ($xml->err['code']) {
case 1:
$burner_count_circulation = 'Feed Not Found';
break;
case 5:
$burner_count_circulation = 'Missing required parameter (URI)';
break;
case 6:
$burner_count_circulation = 'Malformed parameter (DATES)';
break;
}
$burner_date = $today;
}
}
echo $burner_count_circulation.' @ '.$burner_date;
?>

Posted in Feed, PHP, Source Code | 4 Comments »
January 8, 2008 by alvanweb
It is raining slightly, which must be a disappointment to the ladies who are probably wearing most beautiful dresses underneath their mackintoshes. However a strong wind is blowing and perhaps it will clear later in the afternoon.
I am reading Basic econometrics for examination. My next is appraisal economic plans and at last will be industrial economic. They are important and essential lessons in industrial economic field. I must get ready in one week! It is next to impossible…
Posted in General, Life, Persoanal, University | Leave a Comment »
January 6, 2008 by alvanweb
This days I am a little tired and impatient.
I will write here coming soon…
Posted in General, Life, Persoanal | Leave a Comment »
May 26, 2007 by alvanweb

This funny photo creates by Mr. Hamid Barghamadi (one of my best friends) in university of Sistan & Balochestan. The car is Paykan (one of old Irankhordro products that expired in last years) that decorated for marriage celebration.
Posted in Funny, General, Photo, University | 6 Comments »
May 15, 2007 by alvanweb
I just received my Ubuntu 7.04 LTS CD’s today. To my surprise, the packet also includes several Ubuntu stickers. (Picture)
You can get the free CD’s thru this website.
After all, thank you very much Canonical Ltd.
Posted in Linux, Ubuntu | Leave a Comment »
January 20, 2007 by alvanweb
Campaign Monitor launches a brand new email design gallery with more than 100 top notch HTML email designs tagged and categorized. see it here.
Posted in (X)HTML, Bookmarks, Web Design | Leave a Comment »
September 20, 2006 by alvanweb

Download KMZ format here.
Posted in Google, Photo | 1 Comment »
August 9, 2006 by alvanweb
I think one of the foundation web 2.0 properties is tagging. Tags play important role in web pages. But most users don’t know usage in proper method. For example inputting amiss values such as irrelevant characters or words in tags, title and description fields when uploading photos in flickr.
As far as I can see, filling fields with accurate information may be help to visitors. It’s enough to put you in exchange users than come from search engines. But I know not neither can I guess than what we are not more careful?!
Posted in General, Web 2.0 | Leave a Comment »
July 9, 2006 by alvanweb
Once upon a time, different Web browsers supported different forms of HTML markup or “tags.” It was difficult or impossible to make a Web site look good in different browsers. Beginning a few years ago, fortunately, browsers started adopting some common markup styles, loosely known as “Web standards.” Web sites now look roughly the same in different browsers. Users said, “Yea, verily, it is good.” Read this article here .
Posted in CSS, Feed, Web Standards | Leave a Comment »
June 15, 2006 by alvanweb

Я так устал, который я не могу написать больше. только см. эту хорошую фотографию. (I’m so tired that i cannot write more. Just see this nice photo. Moscow skyline evening)
Posted in General, Moscow, Photo | 10 Comments »