Skip to content

Instantly share code, notes, and snippets.

@aaryadev
Created April 6, 2015 16:29
Post file to server via php (cUrl)
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, array('file' => '@/path/to/file.txt'));
curl_setopt($ch, CURLOPT_URL, 'http://server2/upload.php');
curl_exec($ch);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment