怎样把这段PHP代码转换成asp.net (C#)

lsp69 2016-07-18 11:01:52
<?php

$datefirst = '2016-07-17T11:40:04';
$account = '97ec59850e41d3fcd6b35bec2ca44382';
$password = 'b6a29ee7402e728e0ebe3a5a611b0747';
$secure = md5($datefirst."&".$password);

$xml_request = '<?xml version="1.0" encoding="UTF-8" ?>
<DeliveryRequest Number="477" Date="'.$datefirst.'" Account="'.$account.'" Secure="'.$secure.'" OrderCount="1">
<Order Number="863423132451"
DeliveryRecipientCost="0"
SendCityPostCode="125137"
RecCityPostCode="443000"
Address="fdsafsd4333232"
RecipientName="asa22233"
Phone="9171155969"
Comment="eww232323232"
SellerName="ddsdsewew"
TariffTypeCode="137">
<Package Number="1" BarCode="16343245" Weight="1145">
<Item WareKey="1" Cost="2015.00" Payment="0.00" Weight="1145" Amount="1" Comment="5555"/>
<Item WareKey="2" Cost="2015.00" Payment="0.00" Weight="1145" Amount="1" Comment="888888"/>
</Package>
<Call SendCityCode="44" SendAddress="127137, street " SendPhone="84957899166" SenderName="MaxiPost"></Call>
</Order>

</DeliveryRequest>';

$account = '97ec59850e41d3fcd6b35bec2ca44382';
$password = 'b6a29ee7402e728e0ebe3a5a611b0747';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://gw.edostavka.ru:11443/new_orders.php/");
curl_setopt($ch, CURLOPT_USERPWD, "$account.':'.$password");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_PROXY,'127.0.0.1:8888');//设置代理服务器
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 4);
curl_setopt($ch, CURLOPT_POSTFIELDS, array('xml_request' => "$xml_request"));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: close'));
$result = curl_exec($ch);// 执行并获取HTML文档内容

curl_close($ch);// 释放curl句柄


header( "Content-Type: text/xml; charset=UTF-8");
echo $result;

?>
...全文
93 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧