Download a file from web to local

Use this function to download a file from web to local machine.

function WgetFile( $URL, $dir )
{
   $nomefile = $dir . "/" . basename( $URL );
   if ( copy( $URL, $nomefile ) ) {
      return true;
   }
   else {
      return false;
   }
}
 
//Save file to drive c:
WgetFile( 'http://vtwo.ir/src/v2-logo.png', 'c:/' );

Tags

No tag here.

Recommended pages

UTF8 string length counter...

The best way to determine the character count of a UTF8 string. function strlen_utf8( $str ) { return mb_strlen( $str, 'UTF-8' ); }   //or... function strlen_utf8( $str ) { $c = 0;...

How to created mixed arguments function...

This way useful for create mixed arguments function. function foo() { $args = func_get_args(); print_r($args); }   foo(1, 1256, 6, 17); //mixed ...   -------------------Out-...

Parse a string into separate words...

Parse a string into separate words (array output). function parser($str, $char = ' ') { $str = trim($str); $str = $str . $char; $len = strlen($str); $words = array(); $w = '...

alphaID - Translates a number to a short alhanumeric version...

Translates a number to a short alhanumeric version. e.g.: 9007199254740989 --> PpQXn7COf In most cases this is better than totally random ID generators because this can easily avoid duplicate ID's. Fo...