User profile API magento
<?php
error_reporting(0);
$client = new SoapClient('http://www.example.com/api/soap/?wsdl');
// If somestuff requires api authentification,
// then get a session token
$session = $client->login('api User', 'api Key');
$result_array=array();
$id=$_POST["user_id"];
if ($id=="")
{
$result_array["message"]="Please insert customer id";
$result_array["status"]="2";
echo json_encode($result_array);
}
else
{
$result = $client->call($session, 'customer.info', $id);
$result_array["customer_id"]=$result['customer_id'];
$result_array["email"]=$result['email'];
$result_array["firstname"]=$result['firstname'];
$result_array["gender"]=$result['gender'];
$result_array["group_id"]=$result['group_id'];
$result_array["lastname"]=$result['lastname'];
$result_array["middlename"]=$result['middlename'];
$result_array["password_hash"]=$result['password_hash'];
$result_array["message"]="success";
$result_array["status"]="1";
echo json_encode($result_array);
}
// If you want need the session anymore
$client->endSession($session);
?>
No comments: