Click here to Skip to main content
15,908,661 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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);
}
}
Posted

1 solution

I have never tried this, but you can take a look at this,

http://www.cs2php.com/[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900