$fp = fsockopen($this->_xmlHost, 443, $errno, $errstr, 10);
if (!$fp)
{
//echo "$errstr ($errno)<br />\n";
}
else
{
$result = $this->curlSpost($this->_xmlUrl, $sendXml ,10);
$result = str_replace('getlicinfoold','getlicinfo', $result);
$xml = new SimpleXMLElement($result, LIBXML_NOCDATA);
fclose($fp);
return $xml;
}
以上是我需要转换为C#的一些PHP代码。
我的问题是使用fsockopen的目的是什么,是否有必要转换为c#端?我不能通过c#中的WebRequest发送curl并完成它吗?
答案 0 :(得分:1)
只需使用WebClient类发送您的请求即可。它比使用WebRequest抽象了一些。
http://msdn.microsoft.com/en-us/library/debx8sh9%28VS.80%29.aspx