try
{
string ip = (el que nos digan)
string puerto = (el que nos digan)
string url = (la que nos digan)
JavaScriptSerializer jsSerializer = new JavaScriptSerializer();
string prefijoSeri = jsSerializer.Serialize(prefijo);
WebRequest request = WebRequest.Create(string.Format(url, ip, puerto, prefijoSeri));
WebResponse ws = request.GetResponse();
}
catch (Exception ex)
{
throw ex;
}
<?php try{//Inicializamos las variables$ip = (el que nos digan);$puerto = (el que nos digan);$url = (la que nos digan); //Serializamos $prefijo = (el que nos digan);$serialize_prefijo = serialize($prefijo); }catch (Exception ex){ throw ex;}?>
Dictionary post_values = new Dictionary();
post_values.Add("M_ID", "TestUsrID");
post_values.Add("M_KEY", "TestKey");
post_values.Add("T_REFERENCE", "TestRef");
String post_string = "";
foreach (KeyValuePair post_value in post_values)
{
post_string += post_value.Key + "=" + HttpUtility.UrlEncode(post_value.Value) + "&";
}
post_string = post_string.TrimEnd('&');
string VOID_URL = "https://www.sagepayments.net/web_services/vterm_extensions/transaction_processing.asmx/BANKCARD_VOID";
HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(VOID_URL);
objRequest.Method = "POST";
objRequest.ContentLength = post_string.Length;
objRequest.ContentType = "application/x-www-form-urlencoded";
// post data is sent as a stream
StreamWriter myWriter = null;
myWriter = new StreamWriter(objRequest.GetRequestStream());
myWriter.Write(post_string);
myWriter.Close();
// returned values are returned as a stream, then read into a string
HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
using (StreamReader responseStream = new StreamReader(objResponse.GetResponseStream()))
{
post_response = responseStream.ReadToEnd();
responseStream.Close();
}
Console.WriteLine("Response"+post_response);
$param = array("M_ID" => "TestUsrID", "M_KEY" => "TestKey", "T_REFERENCE" => "TestRef");
$url = "https://www.sagepayments.net/web_services/vterm_extensions/transaction_processing.asmx/BANKCARD_VOID";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (curl_errno($ch)) {
echo "Error : ".curl_error($ch));
}
curl_close($ch);
echo "Response : ".$response;
POST /web_services/vterm_extensions/transaction_processing.asmx/BANKCARD_VOID HTTP/1.1
Host: www.sagepayments.net
Content-Type: application/x-www-form-urlencoded
Content-Length: length
M_ID=string&M_KEY=string&T_REFERENCE=string