Skip to content

Instantly share code, notes, and snippets.

@WilCF
Created May 27, 2014 19:55
Show Gist options
  • Save WilCF/df7511124ba941cc7b25 to your computer and use it in GitHub Desktop.
Save WilCF/df7511124ba941cc7b25 to your computer and use it in GitHub Desktop.
I'm using curl on PHP the request parameters are these:
$defaults = array(
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => count($data),
CURLOPT_POSTFIELDS=> json_encode($data, JSON_FORCE_OBJECT),
CURLOPT_HEADER => 0,
CURLOPT_URL => $this->url.$uri.'.json?key='.$this->key,
CURLOPT_FRESH_CONNECT => 1,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_FORBID_REUSE => 1,
CURLOPT_TIMEOUT => 5,
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
)
);
This is the data:
Array
(
[with] => Array
(
[sample_id] => 296
[audio_url] =>
http://voicebunny.s3.amazonaws.com/sample_local/VoiceBunny_-_Voice_Actor_18HI2IO_-_Adult_content_-_English_-_North_American_-_Baby__5F0C534563.mp3
[audio_wave] =>
http://voicebunny.s3.amazonaws.com/sample_local/img/VoiceBunny_-_Voice_Actor_18HI2IO_-_Adult_content_-_English_-_North_American_-_Baby__5F0C534563.png
[actor_name] => Jorge Luis Vargas
[sample_gender] => Baby (<2)
)
[check] => Array
(
[gender] => 1
[actor_name] => 0
[normalized] => 1
[start_silence] => 1
[breathing] => 0
[tongue_clicks] => 0
[popping] => 0
[white_noise] => 0
[background_noise] => 0
[background_music] => 0
[echo] => 0
)
)
And the data parsed to json is this:
{"with":{"sample_id":"296","audio_url":"http:\/\/voicebunny.s3.amazonaws.com
\/sample_local\/VoiceBunny_-_Voice_Actor_18HI2IO_-_Adult_content_-_English_-_North_American_-_Baby__5F0C534563.mp3","audio_wave":"http:\/\/
voicebunny.s3.amazonaws.com\/sample_local\/img\/VoiceBunny_-_Voice_Actor_18HI2IO_-_Adult_content_-_English_-_North_American_-_Baby__5F0C534563.png","actor_name":"Jorge
Luis Vargas","sample_gender":"Baby
(<2)"},"check":{"gender":"1","actor_name":"0","normalized":"1","start_silence":"1","breathing":"0","tongue_clicks":"0","popping":"0","white_noise":"0","background_noise":"0","background_music":"0","echo":"0"}}
And the URL build in the CURLOPT_URL is like this:
https://api.crowdflower.com/v1/jobs/443260/gold.json
I have also an small question, in the check array can I send multiple
options, in the case multiple options are correct?
Let me know if you need something else.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment