Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $adminUrl='http://magento-148486-425775.cloudwaysapps.com/index.php/rest/V1/integration/admin/token';
- $ch = curl_init();
- $data = array("username" => "abc@gmail.com", "password" => "abc@123.");
- $data_string = json_encode($data);
- $ch = curl_init($adminUrl);
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
- curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
- 'Content-Type: application/json',
- 'Content-Length: ' . strlen($data_string))
- );
- $token = curl_exec($ch);
- $token= json_decode($token);
- $randno=rand();
- $email=$randno."@email.com";
- $customerData = [
- 'customer' => [
- "id" => 25,
- "email" => 'subhra@email.com',
- "firstname" => $randno,
- "lastname" => $randno,
- "storeId" => 1,
- "websiteId" => 1,
- "customAttributes" => [
- ],
- "addresses" => [
- ]
- ],
- "password" => 'sbha123@'
- ];
- $headers = array("Authorization: Bearer $token");
- $requestUrl='http://magento-148486-425775.cloudwaysapps.com/index.php/rest/V1/customers/25';
- //echo $requestUrl;exit;
- $ch = curl_init();
- $ch = curl_init($requestUrl);
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($customerData));
- curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: Bearer " . $token));
- $result = curl_exec($ch);
- $result = json_decode($result, 1);
- $adminUrl1='http://magento-148486-425775.cloudwaysapps.com/index.php/rest/V1/integration/customer/token';
- $ch1 = curl_init();
- $data1 = array("username" => 'subhra@email.com', "password" => 'sbha123@');
- $data_string1 = json_encode($data1);
- $ch1 = curl_init($adminUrl1);
- curl_setopt($ch1, CURLOPT_CUSTOMREQUEST, "POST");
- curl_setopt($ch1, CURLOPT_POSTFIELDS, $data_string1);
- curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch1, CURLOPT_HTTPHEADER, array(
- 'Content-Type: application/json',
- 'Content-Length: ' . strlen($data_string1))
- );
- $token1 = curl_exec($ch1);
- echo $token1;
- {"message":"You did not sign in correctly or your account is temporarily disabled.","trace":"#0 [internal function]:
Add Comment
Please, Sign In to add comment