对 C# 的异步 PHP 调用


Asynchronous PHP calls to C#

$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 发送卷曲并完成它吗?

只需使用 WebClient 类发送您的请求。 它比使用WebRequest更抽象。

http://msdn.microsoft.com/en-us/library/debx8sh9%28VS.80%29.aspx