Registration API magento
MAGENTO REGISTRATION API
<?php error_reporting(0); $client = new SoapClient('http://www.example.com/api/soap/?wsdl'); // If some stuff requires api authentification, // then get a session token $session = $client->login('apiUser', 'apiKey'); $email = $_POST['email']; $fname = $_POST['firstname']; $lname = $_POST['lastname']; $password = $_POST['password']; $return_array = array (); if(empty($email) || empty($fname) || empty($lname) || empty($password)) { $return_array['status']= "2"; $return_array['message']= "please provide required parameter"; echo json_encode($return_array); exit; } $cresult = $client->call($session, 'customer.list'); foreach($cresult as $Key=>$val){ if($val['email'] == $email) { $return_array['status']= "0"; $return_array['message']= "Email id already exist"; echo json_encode($return_array); exit; } } $result = $client->call($session,'customer.create',array(array('email' => $email, 'firstname' => $fname, 'lastname' => $lname, 'password' => $password, 'website_id' => 1, 'store_id' => 1, 'group_id' => 1))); if($result==true) { $return_array['status']= "1"; $return_array['message']= "success"; echo json_encode($return_array); exit; }?>
No comments: