|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
grabbing external information
what kinds of information can I grab about an external server or web site from a php page?
|
|
#2
|
|||
|
|||
|
You should be able to get headers from pretty much any open service using the socket_connect function:
http://us4.php.net/socket_connect
__________________
__________________________________________________ _ Wil Moore III, MCP | Integrations Specialist | Senior Consultant Are You Listed...? | DigitallySmooth Inc. |
|
#3
|
|||
|
|||
|
thanks! can you show any small examples?
|
|
#4
|
|||
|
|||
|
Quote:
For a whois server connection try: <?php $fp = fsockopen ("whois.networksolutions.com", 43, $errno, $errstr, 30); if (!$fp) { echo "$errstr ($errno)<br>\n"; } else { fputs ($fp, "devarticles.com\r\n"); while (!feof($fp)) { echo fgets ($fp,128); } fclose ($fp); } ?> |
|
#5
|
|||
|
|||
|
Use this to get a web server's information:
<?php 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); } } print get_server_software("www.devarticles.com"); ?> |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > grabbing external information |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|