Skip to content

Instantly share code, notes, and snippets.

@dineshrabara
Last active August 29, 2015 14:07
Show Gist options
  • Select an option

  • Save dineshrabara/051698deccbc5412cd7f to your computer and use it in GitHub Desktop.

Select an option

Save dineshrabara/051698deccbc5412cd7f to your computer and use it in GitHub Desktop.
File Transfer server to server
<?php
set_time_limit(0);
ini_set('memory_limit', '-1');
/* $str = file_get_contents("http://{siteurl}/project.zip",true);
file_put_contents(getcwd()."/project.zip", $str);
*/
$curl_handle=curl_init();
curl_setopt($curl_handle, CURLOPT_URL,'http://{siteurl}/site.zip');
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_USERAGENT, 'Project');
$query = curl_exec($curl_handle);
curl_close($curl_handle);
file_put_contents(getcwd()."/project.zip", $query);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment