NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page [php] scanning a web site

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search
5 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 01-29-2007, 03:07 PM THREAD STARTER               #1 (permalink)
Account Suspended
 
Alex.'s Avatar
Join Date: Nov 2006
Location: Uk
Posts: 601
Alex. is on a distinguished road
 


Ethan Allen Fund Third World Education

[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!
Alex. is offline  
Old 01-29-2007, 03:28 PM   #2 (permalink)
Senior Member
 
netzilla's Avatar
Join Date: Aug 2005
Posts: 1,716
netzilla is a splendid one to beholdnetzilla is a splendid one to beholdnetzilla is a splendid one to beholdnetzilla is a splendid one to beholdnetzilla is a splendid one to beholdnetzilla is a splendid one to beholdnetzilla is a splendid one to beholdnetzilla is a splendid one to behold
 



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";
} 

?>
netzilla is offline  
Old 01-29-2007, 03:31 PM   #3 (permalink)
NamePros Regular
 
Noobie's Avatar
Join Date: Feb 2006
Location: Montreal, Quebec, Canada
Posts: 324
Noobie is on a distinguished road
 



PHP Code:
@$file file_get_contents("http://www.whatever.com/page.html");
if(
preg_match("#<sometag>(.*?)</sometag>#s",$file,$bla)){ 
   
//do this
????: NamePros.com http://www.namepros.com/programming/287778-php-scanning-a-web-site.html

Is possibly one way of doing it if you need to return the value too
__________________
Goldkey.com is a scam
What's your BMI? | Timestamp Generator
Noobie is offline  
Old 01-29-2007, 03:51 PM THREAD STARTER               #4 (permalink)
Account Suspended
 
Alex.'s Avatar
Join Date: Nov 2006
Location: Uk
Posts: 601
Alex. is on a distinguished road
 


Ethan Allen Fund Third World Education
thanks both of you.
youve answered my question, rep added
Alex. is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


 
All times are GMT -7. The time now is 02:19 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger