| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| Account Suspended Join Date: Nov 2006 Location: Uk
Posts: 601
![]() | [php] scanning a web site hi, another php question. i need a script that scans a site for two pieces of html code, then, when it's scanned it, it performs an action based on wiether it found the either of the code segmants. thanks in advance! |
| |
| | #2 (permalink) |
| Senior Member Join Date: Aug 2005
Posts: 1,716
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | this should do the job Code: <?php
//Pieces of code to search for
$code1 = "<p>";
$code2 = "<body>";
//Grabs content from desired url
$content=file_get_contents("http://www.google.com");
//Searches content for pieces of code
if (strstr($content, $code1) || strstr($content, $code2)) {
// action here
echo "code string found";
}
?> |
| |
| | #3 (permalink) |
| NamePros Regular Join Date: Feb 2006 Location: Montreal, Quebec, Canada
Posts: 324
![]() | PHP Code: |
| |