stradmadhu Posted December 4, 2013 Share Posted December 4, 2013 Hi all, I have a problem to ping a website link. I have to ping many links placed in my textarea. Below is the code :<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script><script type="text/javascript">$(function() {$("#content").focus(function(){$(this).animate({"height": "85px",}, "fast" );$("#button_block").slideDown("fast");return false;});$("#cancel").click(function(){$("#content").animate({"height": "30px",}, "fast" );$("#button_block").slideUp("fast");return false;});});</script><form method="post" action="con1.php">Enter Keywords:<input name="keywords" type="text" value=""><br/><br/>Enter Your Links :<textarea name="contents" rows="3" cols="20"></textarea><div id="button_block"><input type="submit" id="button" value=" Submit "/><input type="submit" id='cancel' value=" cancel" /></div></form>Now this code is the complete design.aftr submit it should ping all my links placed in my text area.I Tried with google bt dint get the right solution. Can some one please help me out?Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/284514-how-to-ping-a-website-link-in-php/ Share on other sites More sharing options...
jazzman1 Posted December 4, 2013 Share Posted December 4, 2013 How the searchable domain name should be? Something like: http://domain.com OR https://domain.com OR domain.com or... by ip address v4 or v6? 123.123.123.123 Quote Link to comment https://forums.phpfreaks.com/topic/284514-how-to-ping-a-website-link-in-php/#findComment-1461264 Share on other sites More sharing options...
dalecosp Posted December 4, 2013 Share Posted December 4, 2013 PHP Parse error: syntax error, unexpected '<script', expecting '<?php' in /usr/home/stradmadhu/original_post on line 1 Quote Link to comment https://forums.phpfreaks.com/topic/284514-how-to-ping-a-website-link-in-php/#findComment-1461275 Share on other sites More sharing options...
jazzman1 Posted December 4, 2013 Share Posted December 4, 2013 (edited) Have a look at example and apply to your wishes: Next URL's will be matched: http://phpfreaks.com http://phpfreaks.com/ https://phpfreaks.com https://phpfreaks.com http://forums.phpfreaks.com/ phpfreaks.com(/) forums.phpfreaks.com(/) by ip addresses: 199.119.180.52 http://199.119.180.52 The script: <?php if (isset($_POST['Submit'])) { $target = stripslashes($_POST['ip']); $pattern = '~^(https?://)?(([a-zA-Z\d-_.]+\.[a-zA-Z]{2,4})||(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}))/?$~'; if (!preg_match($pattern, $target, $matches)) { echo '<pre>ERROR: You have entered an invalid IP or domain name</pre>'; } else { // Determine OS and execute the ping command. if (stristr(php_uname('s'), 'Windows NT')) { $cmd = shell_exec('ping ' . $matches[2]); echo '<pre>' . $cmd . '</pre>'; } else { $cmd = shell_exec('ping -c 4 ' . $matches[2]); echo '<pre>' . $cmd . '</pre>'; } } } ?> <h2>Ping Command Execution</h2> <p>Enter an IP address or domain name below:</p> <form name="ping" action="#" method="post"> <input type="text" name="ip" size="30"> <input type="submit" value="Go!" name="Submit"> </form> Results: PING phpfreaks.com (199.119.180.52) 56(84) bytes of data.64 bytes from phpfreaks.com (199.119.180.52): icmp_seq=1 ttl=50 time=137 ms64 bytes from phpfreaks.com (199.119.180.52): icmp_seq=2 ttl=50 time=234 ms64 bytes from phpfreaks.com (199.119.180.52): icmp_seq=3 ttl=50 time=133 ms64 bytes from phpfreaks.com (199.119.180.52): icmp_seq=4 ttl=50 time=141 ms--- phpfreaks.com ping statistics ---4 packets transmitted, 4 received, 0% packet loss, time 3145msrtt min/avg/max/mdev = 133.385/161.583/234.435/42.158 ms Edited December 4, 2013 by jazzman1 Quote Link to comment https://forums.phpfreaks.com/topic/284514-how-to-ping-a-website-link-in-php/#findComment-1461278 Share on other sites More sharing options...
stradmadhu Posted December 5, 2013 Author Share Posted December 5, 2013 Thanx for the help jazzman1I really appreciate it. I had run the code and its working for domians. But i want it to ping all my SEO links. The is is'nt working for my SEO links. Can some one please help or can please suggest me for it??? And thnx for the rest who replied. Quote Link to comment https://forums.phpfreaks.com/topic/284514-how-to-ping-a-website-link-in-php/#findComment-1461322 Share on other sites More sharing options...
jazzman1 Posted December 5, 2013 Share Posted December 5, 2013 But i want it to ping all my SEO links You can use the ping command to check the destination IP address or domain names that you want to reach and record the results. To reach the content of your links (seo or not) which belong to some particular domain you would use a telnet command. Quote Link to comment https://forums.phpfreaks.com/topic/284514-how-to-ping-a-website-link-in-php/#findComment-1461342 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.