Jump to content

Determine Host site to be php, asp or aspx


kir10s

Recommended Posts

I have a site where customers may download a sample page for their website. They are given the option of asp, php or aspx... my client wants a form button which when clicked, will go to the hostsite of the customers and determine which technology is being supported, so it can sugguest the correct format.

Any suggestions on how to do this?

Thank you in advance
Link to comment
Share on other sites

Your client, is on crack. And possibly heroin too.

There is no real accurate way of doing this, short of having the user provide the info themselves. Quite simply put, there are far too many variables involved to accomplish this without a hitch.

Rethink the approach.
Link to comment
Share on other sites

Thank you! This was what I was feeling too but appriated the validation.

The closest thing I got to this was:

function get_server_software($domain) {
$fp = fsockopen($domain, 80, $errno, $errstr, 1);

if (!$fp) {
return("");
}

else {
fputs($fp, "HEAD / HTTP/1.1\r\nHost: " . $domain . "\r\n\r\n");

while (!feof($fp)) {
if (preg_match("/\bServer:/", $server = fgets($fp, 256))) {
fclose($fp);
return(substr($server, 8, -2));
}
}

fclose($fp);
}
}

Which returns the software the server is using, but this can be ambiguous because if I am not mistaken Windows can run all three...?? or at least for sure aspx and asp..

Kind of a funny side note.. if you use this code and send it to a site hosted by hostica.com, you will be returned 'NOYB' which I believe to be an acronym of None of your business. Try using using aaadiving.com if you want to try it.

Thanks for your support!
Kirsten
Link to comment
Share on other sites

That's not entirely accurate ... (ripping off a line from "Independence Day")

You should be able to use CURL or raw sockets to get the information from the webserver on the remote host. Just ask for the default home page and request all headers be returned. In the headers returned, there should be a line (third line in the non-PHP test I ran) that starts with the word "Server:". This line should tell your what is supported by the server, although it can be turned off.

Ken
Link to comment
Share on other sites

[!--quoteo(post=374416:date=May 16 2006, 03:21 PM:name=kenrbnsn)--][div class=\'quotetop\']QUOTE(kenrbnsn @ May 16 2006, 03:21 PM) [snapback]374416[/snapback][/div][div class=\'quotemain\'][!--quotec--]
This line should tell your what is supported by the server, [u]although it can be turned off[/u].
[/quote]

Exactly. [img src=\"style_emoticons/[#EMO_DIR#]/wink.gif\" style=\"vertical-align:middle\" emoid=\":wink:\" border=\"0\" alt=\"wink.gif\" /]

And I imagine your client would not be happy if the script didn't always do what he wanted it to do. Unless the guy can be reasoned with.

P.S Jeff Goldbloom!!
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.