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; ?>

February 28, 2009 at 6:07 pm |
I love your site! π
_____________________
Experiencing a slow PC recently? Fix it now!
April 22, 2009 at 6:49 am |
The topic is quite trendy on the Internet right now. What do you pay attention to while choosing what to write ?
December 12, 2009 at 2:10 am |
Excuse me for commenting offtopic … what wordpress template do you use? It’s looking stunning!
February 4, 2010 at 2:32 am |
pvcrcfw
γγ£γγγοΌ
γͺγγγΌ
γͺγγγΌ
ιζ΄ε©
SEX
γγ§γ©γγͺ
γ½γΌγ
ιζ΄ε©
εΊεΌ΅γγΉγ
ζγ³γ
γγ£γ±γ
γγ§γ©γγͺ
δΈεΊγ
γ»γγ―γΉ
γγͺγγ«
ε θ
ιζ΄
ζ§ζ¬²
March 11, 2010 at 8:26 am |
Sooooooo amazing post, i love some words so much and may i quote a few of those on my weblog? Also i have e-mailed you relating to would it be possible for us to exchange our links, hope talking with you soon.
April 8, 2016 at 12:07 pm |
Sounds good to me and while were at it maybe Dark Angel as well.I will have to write to them and see if they will add them. I like the idea of none standard super heroβs.nThanks for stopping by. Click http://link.mx/hool08200