Created
June 16, 2014 21:08
-
-
Save donaldallen/ec7b8315b0e3752684bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// What the cURL looks like (it works): | |
// curl -i -X POST -H "Content-Type: application/json" -d '{"table_id":"36694","records":[{"First Name":"Heather", "Last Name":"Smith", "Volunteer":"Heather Smith"}]}' https://api.trackvia.com/records?access_token=ODBlYWU2MjkyMTk4N2ZmY2NlMmQwYTZjNTMyNWIzYzRkZDAwYWJhNzYwZjhkNTkwMTc5OGNjNDMxNDE0ZGQyNA | |
$url = 'https://api.trackvia.com/records/?access_token=' . $token; | |
$record = array( | |
'table_id' => $matching_table_id, | |
'records' => array( | |
'First Name' => $first_name, | |
'Last Name' => $last_name, | |
'Email' => $email, | |
'Program Code' => $program_record['fields']['ProgCode'], | |
'Volunteer' => $first_name . ' ' . $last_name, | |
) | |
); | |
$client = new GuzzleClient(); | |
$request = $client->post($url); | |
$request->setBody(json_encode($record), 'application/json'); | |
$response = $request->send(); | |
// Doesn't work :( |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment