Friday, September 30, 2011

Retrieve a remote page using WordPress

How to retrieve a remote page using WordPress


If you want to get the content,file info from a remote file for use it in wordpress instal then follow the step describe below.
Use the wp_remote_get() function (Or wp_remote_post() is you prefer using the POST method) to retrieve the desired url. The following example describe how to retrieve an url and display its content as well as the file info.

This code can be used anywhere on your template files.

$response = wp_remote_get( 'http://sandipdas.in/file.txt' );
if( is_wp_error( $response ) ) {
echo 'Something went wrong!';
} else {
echo 'Response:';
print_r( $response );

';
}

Wednesday, September 28, 2011

Display your latest Google+ update on WordPress

How to display your latest Google+ update on your WordPress blog


Just paste the following code where you want to display your latest Google+ update. Don't forget to put your Google+ ID on line 3.


include_once(ABSPATH.WPINC.'/rss.php');
$googleplus = fetch_feed("http://plusfeed.appspot.com/117307278436515842100

"); // Replace 117307278436515842100 by your own ID
echo '< a href="'; echo $googleplus->items[0]['link']; echo '">';
echo $googleplus->items[0]['summary'];


echo '';

I just got my #domain @BigRock. Get upto 25% off with my personalized coupon link Get upto 25% off