- Ce sujet contient 0 réponse, 1 participant et a été mis à jour pour la dernière fois par , le il y a 4 années.
Affichage de 1 message (sur 1 au total)
Affichage de 1 message (sur 1 au total)
- Vous devez être connecté pour répondre à ce sujet.
WooFrance Dépannage et support WordPress WooCommerce › Forums › How to WooCommerce › Woo commerce REST API – GET id client
Bonjour,
Comment récupérer dans l’API de Woocommere l’ID du client à partir de son email ?
La réponse est un tableau/array vide !!
$email = urlencode($customers['email']);
$url ='https://xxx.com/wp-json/wc/v2/customers?email='.$email;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json'));
curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, false);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$res = curl_exec($ch);
$err = curl_error($ch);
Merci