Created
February 7, 2017 07:12
-
-
Save mrkhoa99/66a39fdc46958c721bb5160864d27ad9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
$userData = ["username" => "[email protected]", "password" => "123456"]; | |
$ch = curl_init("http://magen2.loc/rest/V1/integration/customer/token"); | |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($userData)); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Content-Lenght: " . strlen(json_encode($userData)))); | |
$token = curl_exec($ch); | |
$emailcontent = [ | |
"email"=> "[email protected]", | |
"template" => "email_reset", // Using template email reset | |
"websiteId" => 1 | |
]; | |
$ch = curl_init("http://magen2.loc/rest/V1/customers/password"); | |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT"); // Put method | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($emailcontent)); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: Bearer " . json_decode($token))); | |
$result = curl_exec($ch); | |
$result = json_decode($result, 1); | |
echo '<pre>';print_r($result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment