0
任何想法如何将下面的php代码示例“转化”为NodeJS中的HTTP API请求?NodeJS API HTTP POST请求身份验证
<?php
$auth='<?xml version="1.0" encoding="UTF-8" ?>
<Auth>
<Username>...</Username>
<PasswordCrypt>...</PasswordCrypt>
<ShopId>...</ShopId>
<AuthCode>...</AuthCode>
</Auth>';
$params='<?xml version="1.0" encoding="UTF-8" ?>
<Params>
<Key>...</Key>
</Params>';
$curl = curl_init();
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_URL, "https://api.unas.eu/shop/getOrder");
curl_setopt($curl, CURLOPT_POSTFIELDS,"auth=".$auth."¶ms=".$params);
$response = curl_exec($curl);
echo $response;
?>
参数必须以(auth,params,XML)POST变量发送。
许多THX提前,
亲切的问候, 索尔特