kir10s Posted May 16, 2006 Share Posted May 16, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/9800-determine-host-site-to-be-php-asp-or-aspx/ Share on other sites More sharing options...
Caesar Posted May 16, 2006 Share Posted May 16, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/9800-determine-host-site-to-be-php-asp-or-aspx/#findComment-36366 Share on other sites More sharing options...
kir10s Posted May 16, 2006 Author Share Posted May 16, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/9800-determine-host-site-to-be-php-asp-or-aspx/#findComment-36369 Share on other sites More sharing options...
kenrbnsn Posted May 16, 2006 Share Posted May 16, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/9800-determine-host-site-to-be-php-asp-or-aspx/#findComment-36371 Share on other sites More sharing options...
Caesar Posted May 16, 2006 Share Posted May 16, 2006 [!--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!! Quote Link to comment https://forums.phpfreaks.com/topic/9800-determine-host-site-to-be-php-asp-or-aspx/#findComment-36372 Share on other sites More sharing options...
kir10s Posted May 16, 2006 Author Share Posted May 16, 2006 Would you be able to post the code so I can run it?Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/9800-determine-host-site-to-be-php-asp-or-aspx/#findComment-36373 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.