Convert 1kb (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 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();
  tcpc.Connect(Request.QueryString["whois"], 43);
catch(SocketException ex)

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>");


Thank you again, so very much.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

igotstehsolutionAuthor Commented:
I need ASP to PHP,

Not PHP to ASP. I also checked for that already... there is no software that converts 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??

ASP to PHP  converter  :)

Happy Coding

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

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.
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.
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.
dammit my code does't seem to have attached:
$whois = fsockopen($_REQUEST['whois'], 43);

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

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

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.