我想将php转换为asp.net? [英] i want to convert php to asp.net ?

查看:50
本文介绍了我想将php转换为asp.net?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

他是我的PHP代码我需要将此部分转换为c#。有人建议我。有没有可用的在线转换工具或任何等效的c#代码也是非常值得的,如果你可以请帮助







函数httpRequest($ url)

{

$ pattern =/ http ...({0-9a-zA-Z-.]* )。([0-9] *)。(。*)/;

preg_match($ pattern,$ url,$ args);



$ in ='';

$ fp = @fsockopen($ args [1],$ args [2],$ errno,$ errstr,20);

if(!$ fp)

{

$ flag ='error';

return($ flag);

//返回($ errstr($ errno));

}

其他

{

$ out =GET / $ args [3] HTTP / 1.1 \\\\ n;

$ out。=主持人:$ args [1]:$ args [2] \\\\ n;

$ out。=用户代理:Robo充值GPRS \\ n;

$ out 。=接受:* / * \\\\ n;

$ out。=连接:关闭\\\\\\\ n;



fwrite($ fp,$ out);

while(!feof($ fp))

{

$ in。= fgets($ fp,128);

}

}

if($ fp)

{

fclose($ fp);

返回($ in);

}

}

解决方案

url)

{


pattern =/ http。 ..([0-9a-zA-Z - 。] *)。([0-9] *)。(。*)/;

preg_match(

图案,

his is my PHP code i need to convert this part to c#. Anybody suggest me. Is there any online conversion tool available Or any equivalent c# code is also is much appreciable and if you can please help



function httpRequest($url)
{
$pattern = "/http...([0-9a-zA-Z-.]*).([0-9]*).(.*)/";
preg_match($pattern,$url,$args);

$in = '';
$fp = @fsockopen("$args[1]", $args[2], $errno, $errstr, 20);
if (!$fp)
{
$flag = 'error';
return($flag);
//return("$errstr ($errno)");
}
else
{
$out = "GET /$args[3] HTTP/1.1\r\n";
$out .= "Host: $args[1]:$args[2]\r\n";
$out .= "User-agent: Robo Recharge GPRS\r\n";
$out .= "Accept: */*\r\n";
$out .= "Connection: Close\r\n\r\n";

fwrite($fp, $out);
while (!feof($fp))
{
$in .= fgets($fp, 128);
}
}
if($fp)
{
fclose($fp);
return($in);
}
}

解决方案

url)
{


pattern = "/http...([0-9a-zA-Z-.]*).([0-9]*).(.*)/";
preg_match(


pattern,


这篇关于我想将php转换为asp.net?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆