Download a file in PHP

Here is a simple function to download a file in PHP and save it on your web server. I needed this for another project, so I coded it and decided to post it up here!
The $file variable is the url to the file
And the $savefile variable is where it should be saved on the server (path and file name)

 
function get_file($file, $savefile)
{
    $out = fopen($savefile, 'wb');
    if ($out == FALSE){
      print "Error opening file<br>";
      exit;
    }
 
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_FILE, $out);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_URL, $file);
    curl_exec($ch);
    echo curl_error ( $ch);
    curl_close($ch);
}
 

BrandonBlogs.Com – The new blog is up!

This is just an update to let you know that my new blog, as previously discussed is now up!

As I mentioned before, I will be writing about how I make money online to allow you to do the same with ease. Most people that make money online are not programmers, which is why I have an advantage. I create tools to make things easier, i'm lazy, I like to make things easy. Both blogs will be tied together, Bncapps and Brandon Blogs. Programming stays on this side, the rest is on the new site.

So check it out! Read the Welcome Post to find out what's to come! As stated in the welcome post, I am still working on the layout and design, so it wont look all that nice at this moment, but it will soon!

http://BrandonBlogs.com

How I make money Online – New blog coming soon!

I have had next to no time recently to post here! Hopefully I can find some time to continue posting up programming tutorials.

I just want to announce that I plan on launching a blog on how I personally make money online. I am fairly young (just turned 18 last month), yet I am making quite a bit of money each month for doing things I find fun. I'm sure what I make is way more than any part time job I could get...and each month its up and up.

When it's up, you all will be the first to know. I will talk about making money through Adsense (And if you follow me on twitter you may have seen my recent tweets about the record days), through affiliates, through Twitter, freelancing and many more methods.

Keep reading, follow me on twitter, subscribe to the feed to be the first to hear about it and get in quick!

Exclusive tools that have never been before released will be released on the new site to assist you in making money online with the least amount of work!

Three New Play-Asia Coupons!

I got ahold of 3 new play-Asia.com coupons, each one is one use only.
First one: CM-EQZ-LNE
This is for $5 off of orders $50 or more

The next two:

Twitter Poster plugin : Pregnancy Calendar