Created
April 25, 2014 16:12
-
-
Save miwebguy/11294828 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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