Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Script to search for word on web page

Tags:

html

php

parsing

Can someone please show me how to change the following PHP script to say "found" if the site http://www.stutteringjohnsmith.com has the word "standup" in it and to say "not found" if it does not

<?php
$data = file_get_contents('http://www.stutteringjohnsmmith.com/#/0');
$regex = '/Page 1 of (.+?) results/';
preg_match($regex,$data,$match);
var_dump($match);
echo $match[1];
?>
like image 697
SJS Avatar asked Dec 09 '25 02:12

SJS


1 Answers

<?php
$data = file_get_contents('http://www.stutteringjohnsmmith.com/#/0');
$regex = '/standup/';    //<----
preg_match($regex,$data,$match);
var_dump($match);
echo $match[1];
?>

lol?

like image 130
dynamic Avatar answered Dec 10 '25 14:12

dynamic



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!