我在 soap api 中使用以下代码忘记密码 magento 以及如何发送更改密码的邮件链接用户抛出api使用magento功能邮件使用,如果有任何简单的相关 rest api 指导我
error_reporting(0);
$client = new SoapClient('http://127.0.0.1/mycart/api/soap/?wsdl');
$session = $client->login('admin', '123456789');
$return_array = array ();
$result = $client->call($session, 'customer.list');
$email=addslashes($_POST['email']);
//$email=addslashes("test@mail.com");
if(!empty($email)){
foreach ($result as $key=>$value){
//echo $value[email];
if ($value[email]==$email)
{
$return_array['message']="You will receive an email with a link to reset your password ";
$return_array['status']= "1";
echo json_encode($return_array);
exit;
}elseif ($value[email]!=$email) {
$return_array['message']="You are not registered with us. Please sign up to create an account";
$return_array['status']= "2";
echo json_encode($return_array);
exit;
}
}
}
else {
$return_array['message']="You are not registered with us. Please sign up to create an account ";
$return_array['status']= "0";
echo json_encode($return_array);
exit;
}
exit;
答案 0 :(得分:0)
我猜你正在使用管理员凭据进行客户端登录,你也在使用magento api V1,无论Magento v1还是v2 api都需要api用户。请按照指导 https://www.yireo.com/tutorials/magebridge/administration/596-step-by-step-create-a-magento-api-user