moding a link check script

Discussion in 'PHP' started by mikemason, May 4, 2008.

  1. #1
    I found a link check script (phpLinkCheck.zip)
    that checks for links on url's (see demo) but it only checks one at a time... how can I change it to check 50 at a time? I don't need a form I'll hand code into it, but I do need it to have the to url & from url to check many sites for my many links.
    (a flatfile DB would be better )

    here's the form code:
    <div style="font-family: verdana; font-size: 12px; border: 1px solid #EAEAEA; background-color: #F6F7F8; width: 270px; padding: 5px">
    
    <div style="background-color: #F1F2F3; font-weight: bold; border: 1px dashed #A8A8A8; width: 260; padding: 5px">
    <?php
    	echo 'Status: ';
    	if(isset($_POST['check'])){
    		include('linkcheck.php');
    	}
    	else{
    		echo 'Waiting for link';
    	}
    ?>
    </div>
    
    <br />
    <form method="post" action="example_linkcheck.php">
    <p>Website? (http://)<br /><input type="text" name="check" size="40" maxlength="150" /></p>
    <p>Contains Link? (http://)<br /><input type="text" name="for" size="40" maxlength="150" /></p>
    <p><input type="submit" value="Check for link" /></p>
    </form>
    </div>
    Code (markup):
    this script is open source.
    Thanks for any help, Mike
     
    mikemason, May 4, 2008 IP
  2. Randombase

    Randombase Peon

    Messages:
    224
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You could create a textarea in example_linkcheck.php, replacing the form. For example:
    <br />
    <form method="post" action="example_linkcheck.php">
    <p>Website? (http://)<br /><textarea name="check"></textarea></p>
    <p>Contains Link? (http://)<br /><input type="text" name="for" size="40" maxlength="150" /></p>
    <p><input type="submit" value="Check for link" /></p>
    </form>
    </div>
    Code (markup):
    Now you can enter all the url's you want to check, one per line.

    And then change the PHP code to something like this :) :
    <?php
    	echo 'Status: ';
    	if(isset($_POST['check'])){
    		$lines = explode("\n",$_POST['check']);
    		foreach($lines as $variable)
    		{
    			$_POST['check'] = $variable;
    			include('linkcheck.php');
    		}
    	}
    	else{
    		echo 'Waiting for link';
    	}
    ?>
    PHP:
    I think this should work as this, could need some optimizing though :)
     
    Randombase, May 4, 2008 IP
  3. mikemason

    mikemason Peon

    Messages:
    184
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks a great tip, thanks
     
    mikemason, May 5, 2008 IP