[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 443
  • Last Modified:

Convert 1kb asp.net (C#) file into PHP

I am fairly new to PHP and I am trying to learn full speed. Recently I ran into a situation where I could not use an asp.net file and had to convert to PHP. I am really at no level to be able to convert this file.

Any help very appreciated, you will help me a lot :)


DomPortSheck.aspx code:


<% @Page Language="C#" debug = true%>
<% @Import Namespace="System.Net.Sockets" %>
<% @Import Namespace="System.Text" %>
<% @Import Namespace="System.IO" %>
<%


TcpClient tcpc = new TcpClient();
try
{
  tcpc.Connect(Request.QueryString["whois"], 43);
}
catch(SocketException ex)
{
  Response.Write(ex.ToString());
  Response.End();
}

String strDomain = Request.QueryString["domain"] + "\r\n";
Byte[] arrDomain = Encoding.ASCII.GetBytes(strDomain.ToCharArray());

Stream s = tcpc.GetStream();
s.Write(arrDomain, 0, strDomain.Length);

StreamReader sr = new StreamReader(tcpc.GetStream(), Encoding.ASCII);
string strLine = null;

while (null != (strLine = sr.ReadLine()))
{
   Response.Write(strLine + "<br>");
}

tcpc.Close();
%>



Thank you again, so very much.
0
igotstehsolution
Asked:
igotstehsolution
1 Solution
 
igotstehsolutionAuthor Commented:
I need ASP to PHP,

Not PHP to ASP. I also checked for that already... there is no software that converts asp.net to php.


I also read that MSDN article before, it does not cover everything, just basics. Thanks for trying though!


Anyone else that can be of help??
0
 
plusone3055Commented:
http://www.design215.com/toolbox/translator/trans_login.php

ASP to PHP  converter  :)

Happy Coding

0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
igotstehsolutionAuthor Commented:
Sign up system doesn't send verification. I checked spam, yes. And I also tried 3 different email address

1 yahoo,
1 msn,
1 my own server.


It said it doesn't convert all, but I'll take whatever I can get. Including if someone could do the conversion quickly for me, I'll donate via paypal too if you require.
0
 
Ted BouskillSenior Software DeveloperCommented:
They are really very different runtimes and languages.  I doubt that any translators of any quality exist.  I'm sorry but you are going to have to do a rewrite.
0
 
danyul_cCommented:
hmm, try this out. I'm sorry I don't have time to test it at the moment but just off the top of my head this is what I would do (well no, I wouldn't, I would have it set up as a class, but as a drop in replacement this should work):

This also may not be "the" most efficient way, but all I could think up in 2 mins.
0
 
danyul_cCommented:
dammit my code does't seem to have attached:
<?php
$whois = fsockopen($_REQUEST['whois'], 43);

if ($whois !== false) {
  fwrite($whois, $_REQUEST['domain'] . '\r\n');
  $response = '';

  while (!feof($whois)) {
    $response .= fgets($whois, 1024);
  }
  
  fclose($whois);
  echo $response;
} else {
  echo 'Could not connect to the whois server at ' . $_REQUEST['whois'];
}

Open in new window

0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now