Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/292.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/287.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 对C的异步PHP调用# $fp=fsockopen($this->\xmlHost,443,$errno,$errstr,10); 如果(!$fp) { //回显“$errstr($errno)\n”; } 其他的 { $result=$this->curlSpost($this->xmlUrl$sendXml,10); $result=str_replace('getlicinfoold','getlicinfo',$result); $xml=新的simplexmlement($result,LIBXML_NOCDATA); fclose($fp); 返回$xml; }_C#_Php_Asynchronous - Fatal编程技术网

C# 对C的异步PHP调用# $fp=fsockopen($this->\xmlHost,443,$errno,$errstr,10); 如果(!$fp) { //回显“$errstr($errno)\n”; } 其他的 { $result=$this->curlSpost($this->xmlUrl$sendXml,10); $result=str_replace('getlicinfoold','getlicinfo',$result); $xml=新的simplexmlement($result,LIBXML_NOCDATA); fclose($fp); 返回$xml; }

C# 对C的异步PHP调用# $fp=fsockopen($this->\xmlHost,443,$errno,$errstr,10); 如果(!$fp) { //回显“$errstr($errno)\n”; } 其他的 { $result=$this->curlSpost($this->xmlUrl$sendXml,10); $result=str_replace('getlicinfoold','getlicinfo',$result); $xml=新的simplexmlement($result,LIBXML_NOCDATA); fclose($fp); 返回$xml; },c#,php,asynchronous,C#,Php,Asynchronous,上面是我需要转换为C#的一些PHP代码 我的问题是使用fsockopen的目的是什么,是否有必要为c端进行转换?我不能在c#中通过WebRequest发送curl并完成它吗?只需使用WebClient类发送您的请求即可。它比使用WebRequest抽象了一点 fsockopen的异步功能是什么? $fp = fsockopen($this->_xmlHost, 443, $errno, $errstr, 10); if (!$fp) { //echo "$errstr ($errn

上面是我需要转换为C#的一些PHP代码


我的问题是使用fsockopen的目的是什么,是否有必要为c端进行转换?我不能在c#中通过WebRequest发送curl并完成它吗?

只需使用WebClient类发送您的请求即可。它比使用WebRequest抽象了一点


fsockopen的异步功能是什么?
$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;
}