Skip to content

Instantly share code, notes, and snippets.

@miwebguy
Created April 25, 2014 16:12
Show Gist options
  • Select an option

  • Save miwebguy/11294828 to your computer and use it in GitHub Desktop.

Select an option

Save miwebguy/11294828 to your computer and use it in GitHub Desktop.
<?php
$url="http://thehilolowdown.blogspot.com/feeds/posts/default?max-results=1";
$_c = curl_init();
curl_setopt($_c, CURLOPT_URL, $url);
curl_setopt($_c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($_c, CURLOPT_TIMEOUT, 3);
//curl_setopt($_c, CURLOPT_USERPWD, "$_user:$_pass");
//curl_setopt($_c, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$_data = curl_exec($_c);
$response= curl_getinfo($_c);
curl_close($_c);
# check curl response
if ($_data) {
if ($response['http_code'] == 200) {
$r='OK';
echo trim($_data);
exit();
} else { $r = 'OIEERR'; }
} else { $r = 'SYSERR'; }
if($r=="OK"){
$_blog= simplexml_load_string($_string);
$_blogposts=array();
foreach ($_blog->entry as $entry) {
array_push($_blogposts,array(
"title"=>$entry->title,
"content"=>$entry->content,
"summary"=>$entry->summary,
"link"=>$entry->link[2]["href"]
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment