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
https://forums.phpfreaks.com/topic/9800-determine-host-site-to-be-php-asp-or-aspx/
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
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
[!--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!!

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.