ChambeRFienD Posted June 13, 2006 Share Posted June 13, 2006 I've heard of people being able to pull text from a website using fopen or something of the sort, but I'm looking to write a little PHP program to make my job go a bit faster at work. (We deal with a lot of domain names)I was wondering if there was a way to ping a website with PHP and return the IP address of that site. I'm also looking for a way to pull the title from a website and return that if possible. Anyone have any ideas that could help me out? Link to comment https://forums.phpfreaks.com/topic/11911-pinging-and-grabbing-info-from-a-website/ Share on other sites More sharing options...
joquius Posted June 13, 2006 Share Posted June 13, 2006 @php.net:[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Example 1. A simple gethostbyname() example<?php$ip = gethostbyname('www.example.com');echo $ip;?> [/quote] Link to comment https://forums.phpfreaks.com/topic/11911-pinging-and-grabbing-info-from-a-website/#findComment-45187 Share on other sites More sharing options...
ChambeRFienD Posted June 13, 2006 Author Share Posted June 13, 2006 [!--quoteo(post=383437:date=Jun 13 2006, 03:49 PM:name=joquius)--][div class=\'quotetop\']QUOTE(joquius @ Jun 13 2006, 03:49 PM) [snapback]383437[/snapback][/div][div class=\'quotemain\'][!--quotec--]@php.net:[/quote]Thanks much for that.. A lot easier than what I was thinking. I was heading more towards the system() function. =xUsing this now:[code]<?$host = 'lkasdflkawefhasdh.com';$ip = gethostbyname($host);if($ip == $host) { echo "Unable to find host.";} else { echo $ip;}?>[/code]Now to grab the titles from websites.. Link to comment https://forums.phpfreaks.com/topic/11911-pinging-and-grabbing-info-from-a-website/#findComment-45193 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.