Create a file in root directory. Include mage File under app.
Create file Like getuserinfo_webservice.php in root directory.
<?php require_once 'app/Mage.php'; Mage::app('default'); Mage::getSingleton("core/session", array("name" => "frontend")); if (Mage::getSingleton('customer/session')->isLoggedIn()) { // Load the customer's data $customer = Mage::getSingleton('customer/session')->getCustomer(); if($customer->getId()) { $customerId = $customer->getId(); } else { $customerId=''; } if( $customer->getName()) { $fullname= $customer->getName(); // Full Name } else { $fullname=''; } if($customer->getFirstname()) { $firstname==$customer->getFirstname(); // First Name } else { $firstname=""; } if($customer->getMiddlename()) { $middlename=$customer->getMiddlename(); // Middle Name } else { $middlename=""; } if($customer->getLastname()) { $lastname = $customer->getLastname(); // Last Name } else { $lastname=''; } if($customer->getEmail()) { $emailId = $customer->getEmail(); } else { $emailId=''; } if($customer->getGender()) { $gender=$customer->getGender(); // ID } else { $gender=''; } if($customer->getDefaultBilling()) { $defaultbillingId=$customer->getDefaultBilling(); // ID } else { $defaultbillingId=''; } if($customer->getDefaultBilling()) { $defaultshippingId=$customer->getDefaultShipping(); // ID } else { $defaultshippingId=''; } $customer->getDob(); // yyyy-mm-dd hh:mm:ss if($customer->getDob()) { $dob=$customer->getDob(); // ID } else { $dob=''; } $customer->getTaxClassId(); // ID $data['responseCode']='1'; $data['msg']="Successfull"; $data['result']=array("customerId"=>$customerId,"fullName"=>$fullname,"firstName"=>$firstname,"middleName"=>$middlename,"lastName"=>$lastname,"defaultBillingId"=>$defaultbillingId,"defaultShippingId"=>$defaultshippingId,"dob"=>$dob,"emailID"=>$emailId,"gender"=>$gender); } else { $data['responseCode']='0'; $data['msg']='Please Login First'; } echo json_encode($data); ?>
EmoticonEmoticon