Re: PHP on domain...

From: Date: Sun, 29 Jan 2006 22:12:33 +0000
Subject: Re: PHP on domain...
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-229436@lists.php.net to get a copy of this message
----- Original Message ----- From: "Steve Edberg" <sbedberg@ucdavis.edu> To: "Gustav Wiberg" <gustav@varupiraten.se>; "PHP General" <php-general@lists.php.net> Sent: Sunday, January 29, 2006 10:51 PM Subject: Re: [PHP] PHP on domain...
At 10:08 PM +0100 1/29/06, Gustav Wiberg wrote:
Hi guys! How can you check if a domain (that you don't own), can run PHP-code? Is it possible? /G @varupiraten.se
Answer 1: Call them, fax them, email them, IM them, or check their website. This is the only way to know for sure. Answer 2: Check http://netcraft.com/ I don't know all the tools they use to record server information, but I presume that it includes methods like Answer 3 below. Answer 3: If you want to do this via a program, the answer is - in general, no. However, many servers will return an HTTP header containing this info. Also, (at least on Apache) server signatures may be set to reveal this info on error displays. You could open a socket connection to port 80 of the desired domain, and issue a HEAD request. You'll have to parse the results for Server and/or X-Powered-By and possibly other headers. Here's some examples via telnet: telnet <domain deleted> 80 Trying <ip address deleted>... Connected to <domain deleted>. Escape character is '^]'. HEAD / HTTP/1.0 HTTP/1.0 200 OK Date: Sun, 29 Jan 2006 21:23:03 GMT Server: Apache Content-Type: text/html Connection: close telnet <domain deleted> 80 Trying <ip address deleted>... Connected to <domain deleted>. Escape character is '^]'. HEAD / HTTP/1.0 HTTP/1.1 403 Access Forbidden Server: Microsoft-IIS/5.0 Date: Sun, 29 Jan 2006 21:32:26 GMT Content-Length: 4126 Content-Type: text/html telnet <domain deleted> 80 Trying <ip address deleted>... Connected to <domain deleted>. Escape character is '^]'. HEAD / HTTP/1.0 HTTP/1.0 302 Moved Temporarily Date: Sun, 29 Jan 2006 21:36:52 GMT Server: Apache/1.3.33 (Unix) PHP/4.3.10 mod_ssl/2.8.22 OpenSSL/0.9.7e X-Powered-By: PHP/4.3.10 Location: index_html.html Content-Type: text/html Connection: close However, many servers are set to not reveal this info for security purposes; it could also be spoofed for the same reason. For example, the second site above (the IIS one) actually *does* support PHP according to their website. See http://www.php.net/manual/en/ref.sockets.php for info on opening & reading from sockets; there is an example on this page in the user comments about sending HTTP HEAD requests. steve -- +--------------- my people are the people of the dessert, ---------------+
| Steve Edberg                                http://pgfsun.ucdavis.edu/ |
| UC Davis Genome Center                            sbedberg@ucdavis.edu |
| Bioinformatics programming/database/sysadmin             (530)754-9127 |
+---------------- said t e lawrence, picking up his fork ----------------+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Hi there!
Thanx for info! /G

« previous php.general (#229436) next »