Skip to content

Instantly share code, notes, and snippets.

@Gazer
Created June 28, 2011 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gazer/1051321 to your computer and use it in GitHub Desktop.
Save Gazer/1051321 to your computer and use it in GitHub Desktop.
CS API
<?php
$api = new CSApi($public_key, $private_key);
$res = $api->check_authentication('e@mail.com', 'clave');
if ($api->has_errors) {
echo "$api->last_error.\n";
} else {
if ($res == 0) {
echo 'Email o clave no valido';
} else {
echo "User id : $res\n";
}
}
?>
<?php
$api = new CSApi($public_key, $private_key);
$res = $api->create_user(array(
'user' => array(
'email' => 'test@tes1t.com',
'phone_number' => '011-4777-5555',
'dni' => '1234567890',
'terms' => '1',
'male' => '1',
'name' => 'some',
'lastname' => 'body',
'birthday' => '11/11/1911',
'speedy_user' => 'algo@speedy',
'password' => '123456',
'password_confirmation' => '123456',
)));
// Check for API errors. (Timeout, bad API key, etc)
if ($api->has_errors) {
die("$api->last_error.\n");
}
// Check for validation errors (bad format, missing required fields, etc)
if ($res->error) {
foreach($res->error as $error) {
echo "$error.\n";
}
} else {
echo 'usuario creado';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment