Created
June 28, 2011 15:00
-
-
Save Gazer/1051321 to your computer and use it in GitHub Desktop.
CS API
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 | |
$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"; | |
} | |
} | |
?> | |
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 | |
$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