0
我該怎麼做ASP.Net(C#)?我該怎麼做Asp.Net?
//<?php
$host = "https://****/";
$curl = curl_init($host);
// examp is username, 1 is password for Luna Payment
curl_setopt($curl, CURLOPT_USERPWD, "examp:1");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_AUTOREFERER, true);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 80);
curl_setopt($curl, CURLOPT_MAXREDIRS, 3);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
$raw_result = curl_exec($curl);
$http_status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
$response = json_decode($raw_result, true);
if ($response['status'] == 'OK') {
echo "Completed";
} else if ($response['status'] == 'Incomplete') {
echo "Error: No ";
} else {
$last_transaction = end($response['transactions']);
echo "Error: " . $last_transaction['error_message'];
}
搜索HttpWebRequest的,你會發現教程。這是Curl在Asp.Net – Kuzgun
中的等價性可能的重複http://stackoverflow.com/questions/20315684/curl-to-c-sharp-httpwebrequest –