Skip to content

Instantly share code, notes, and snippets.

@gillien
Created October 10, 2012 08:28
Show Gist options
  • Save gillien/3864051 to your computer and use it in GitHub Desktop.
Save gillien/3864051 to your computer and use it in GitHub Desktop.
$project['name'] = 'test';
$project['ctype'] = 'proofreading';
$project['language_from'] = 'fr';
$project['language_to'] = 'fr';
$project['category'] = 'C003';
$project['project_briefing'] = 'Hello word';
$project['same_author_must_do_entire_project'] = 'false';
$project['language_level'] = 'basic_language_level';
$project['work_template'] = 'Default';
$ch = curl_init();
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTP_VERSION , CURL_HTTP_VERSION_1_1);
date_default_timezone_set('UTC');
$date = date('Y-m-d H:i:s');
$signature = sha1($this->secretapi.$date);
$headers = array('APIKEY: '.$this->keyapi,'DATE: '.$date, 'SIGNATURE: '.$signature);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers );
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(array('project' => $project)));
$url = $this->urlAPi . '/projects';
curl_setopt($ch, CURLOPT_URL, $url );
$result = curl_exec($ch);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment