help me, how to find text on an external html site using PHP


Posted on 16th Feb 2014 07:03 pm by admin

Would anyone know how to search an external html file for a work or phrase ?

I was thinking something like this --
I use script cURL...
Did you know?Explore Trending and Topic pages for more stories like this.

Code: <?php
if (isset($_POST['submitted'])) {

$xurl_1 = $_POST['url_1'];
$xtext_1 = $_POST['text_1'];

function check_1($url_1, $text_1){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url_1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$result=curl_exec ($ch);
curl_close ($ch);

preg_match ("|<[pP]>".$text_1."</[pP]>|i", $result, $matches);

if (count($matches)>0){
$i=true;
}else{
$i=false;
}
return $i;
}

if(check_1( $xurl_1, $xtext_1)){
echo "Text found";
}else{
echo "Text not found";
}

} else {
?>

<h3>Link Verifier</h3>
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post">
<p><b>URL :</b> <input type="text" name="url_1" size="30" value="" /></p>
<p><b> Exist :</b> <input type="text" name="text_1" size="30" value="" /></p>
<div align="center"><input type="submit" name="submit" value="Check" /></div>
<input type="hidden" name="submitted" value="TRUE" />
</form>
<?php
}
?>

Unfortunently, that doesn't work..

it say:
Quote"Fatal error: Call to undefined function curl_init() in /home/*/*/new.php on line 8"

how to install cURL on windows?
No comments posted yet

Your Answer:

Login to answer
164 Like 34 Dislike
Previous forums Next forums
Other forums

foreach iterator
Hi Guys
Does the foreach loop have an inbuilt iterator ?

Download Image from URL and Upload it
Ok, I have been googling for the last 1/2 hour trying to figure this out, Most likely I'm just not s

Pass sql into pl/sql and create RMAN duplicate script.
Hi,

I'm new to pl/sql and I'm trying to write a script that will generate some RMAN comma

Fetching array then reversing it
Hi, I have a simple problem, I'll try to explain it as best I can:
News entries in my database ar

making web pages for accounts
Hello, I would like to make pages for accounts on my website im making (its not a real website..im j

Wierd if else problem
Hi guys,

this probably aint wierd for you, but it seems like php is playin up to me. may b i

Casting Decimals in Oracle
This code worked as a query in DB2, but I am not sure what the syntax is for casting decimals in Ora

Allegro crashes when running load_bitmap. Why?
I can not get Allegro to load any BMP images. Here is a section of test code. The picture is in the

A problem with my GD class
Hello,

I created a nice (and simple for now) GD class.
The problem is , it works great on

Please help understand this code
I noticed the index page on my site was modified this morning and found this code inserted at the bo

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash