Skip to content

Instantly share code, notes, and snippets.

@jwage
Created December 14, 2010 07:56
Show Gist options
  • Save jwage/740126 to your computer and use it in GitHub Desktop.
Save jwage/740126 to your computer and use it in GitHub Desktop.
$path = sfConfig::get('sf_upload_dir').'/tracks/';
$fp = fopen($path.$track->getTeaserFile(), 'a+');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.musicalturk.com/teaser.php');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_BUFFERSIZE, 256);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)");
curl_setopt($ch, CURLOPT_POST, true); $post = array(
'file' => '@'.$path.'/'.$track->getFile(),
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_FILE, $fp); // Data will be sent to our stream ;-)
$response = curl_exec($ch);
curl_close($ch);
fclose($fp);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment