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提前,
親切的問候, 索爾特