0
嗨我想用cURL編程。 但還沒有開始它也回報我機智的服務器內部錯誤。 cURL中的給定代碼有任何錯誤嗎?用cURL發佈到XML,Noob here學習
<?php';
$now = new DateTime();
$url = "smsx.ia.com.my";
$parameters = array(
'UserID' => '[email protected]',
'Version' => '1.0',
'Action' => 'ProductCreate',
'Timestamp' => $now->format(DateTime::ISO8601),
);
// Sort parameters by name
ksort($parameters);
$params = array();
foreach ($parameters as $name => $value) {
$params[] = rawurlencode($name) . '=' . rawurlencode($value);
}
$strToSign = implode('&', $params);
// Compute signature and add it to the parameters
$parameters['Signature'] =
rawurlencode(hash_hmac('sha256', $strToSign, $api_key, false));
// Build Query String
$queryString = http_build_query($parameters, '', '&', PHP_QUERY_RFC3986);
// Open Curl connection
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url."?".$queryString);
// Save response to the variable $data
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlPayload);
$data = curl_exec($ch);
// Close Curl connection
curl_close($ch);
if (isset($_POST['Submit'])) {
}
?>
<form action="" method="post">
<input type="submit">
</form>
所以我試圖發佈信息到URL,但我只是加載網站,它給了我係統內部錯誤。 無法繼續。
任何想法爲什麼我面臨這個問題?