Month: February 2012

PHP: Copy image from remote server to local server

You might want to copy an image (or any other file) with PHP from a remote location to your local server and store it in a specific location. You can use the PHP file_get_contents() function to achieve this. Here is a code sample: $remoteimage = "http://domain.com/path/to/remote/image.jpg"; $localimage = "/home/domain/httpdocs/path/to/my/image.jpg"; if ($content = file_get_contents($remoteimage)) { if (!empty($content)) { $fp = fopen($localimage, "w"); fwrite($fp, $content); fclose($fp); } } You can get the code here: Copy image from remote server to local...

Read More

WordPress: Add RSS feed to sidebar

You can easily add any RSS feed (remote or local feed) to your WordPress sidebar using a sidebar widget. To do this, go to Appearance > Widgets in your WordPress dashboard and locate the RSS sidebar widget. Then you’ll drag the RSS sidebar widget to one of your sidebars where you would like it to be. Once you drop the RSS sidebar widget into one of your sidebars, it will expand, allowing you to configure the widget with a feed URL and a title for the sidebar widget to show on the front-end of your site. Fill in your feed URL (any URL, even a remote website’s feed), give the sidebar widget a title and then you can choose the number of items to show. Additionally you can tick/check whether the content/descriptions, author(s) and/or post date should be shown as well. Then click the ‘Save‘ (blue) button in the widget controls and go to the front-end of your WordPress website to see the results. It will display a sidebar widget with the items in the RSS feed accordingly. Considering that the URL you entered is a valid RSS feed and that it is...

Read More

Pin It on Pinterest

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!