PHPCodez

Search
Skip to content
  • Home
  • PHP
  • Functions
  • WordPress
  • Plugins
  • Joomla
  • Magento
  • Linux
  • My SQL
  • jQuery
  • Profile
  • comments
Magento

Magento 2 API Customer Login

March 21, 2018 Pramod T P Leave a comment

You can use the following code for this tas.

<?php
 $magentoURL = "http://127.0.0.1/mage2/";
 $apiURL = $magentoURL."index.php/rest/V1/integration/customer/token";
 $data = array("username" => "Test.User1521623008@phpcodez.com", "password" => "Phpcodez1&");
 $data_string = json_encode($data);

$ch = curl_init($apiURL);
 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);

echo($token);
?>
APICustomereCommerceLoginMagento 2PHP

Post navigation

Previous PostMagento 2 Module StatusNext PostMagento 2 API Customer Details

Beginners' Guide

Recent Posts

  • openvpn3 disconnect session
  • start openvpn centos 7
  • size of folder in linux terminal
  • /var/crash/ files
  • Public Cloud

Recent Comments

  • NickyOKiefer on comments
  • 검증사이트 on compare two strings – javascript
  • https://www.postonlineads.com/ on Install rar on ubuntu
  • farhangift on XAMP Change Localhost To Domain
  • دانلود بازی اندروید on Include a block in sidebar – Magento

Categories

  • .htaccess (32)
  • Ajax (4)
  • Apache (43)
  • AWS (9)
  • Cookie (4)
  • Database Model (9)
  • Design Pattern (9)
  • Filter (27)
  • General (184)
  • HTML (1)
  • IP.Board (1)
  • Javascript (60)
  • Jetty (3)
  • Joomla (17)
  • jQuery (63)
  • JSON (3)
  • JSP (1)
  • Linux (117)
  • Magento (363)
  • My SQL (72)
  • nginx (4)
  • OOPs (12)
  • Payment Gateway (1)
  • PHP (1,004)
  • Plugins (11)
  • Prototype (1)
  • session (5)
  • Socialengine (1)
  • SQL (69)
  • SVN (17)
  • Uncategorized (11)
  • Vbulletin (11)
  • Wordpress (89)
Proudly powered by WordPress