Skip to content

Instantly share code, notes, and snippets.

@adatta02
Created February 16, 2012 22:20
Show Gist options
  • Save adatta02/1848304 to your computer and use it in GitHub Desktop.
Save adatta02/1848304 to your computer and use it in GitHub Desktop.
tru.ly webservices example
<?php
$userData = array(
"api[key]" => "YOUR_KEY",
"user[email]" => "example@tru.ly",
"user[first_name]" => "Dave",
"user[last_name]" => "Smith",
"user[zip_code]" => "02139",
"user[street_address]" => "222 3rd st.",
"user[birthday_month]" => "1",
"user[birthday_day]" => "1",
"user[birthday_year]" => "1980",
"user[last_four_social]" => "1234",
"user[opted_in]" => true,
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://tru.ly/api-verify-user");
curl_setopt($ch, CURLOPT_FAILONERROR, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT, 300);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $userData);
$result = curl_exec($ch);
curl_close($ch);
print_r( json_decode($result, true) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment