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

Error In Syntax
I got this error:

Code: Parse error: syntax error, unexpected '>' in /home/bucket/publ

RSS poster script?
I have found a script that posts RSS's for me on a site that I'm building. However I would like to a

Email with Attachments in PHP
Hi Friends

How to send email in PHP with attachment.
I know simple mail can be sent with

if description does not contain the following words
Hello everyone,

I am parsing a MS Excel (.xls) file and adding it's content to a mySQL databa

FFmpeg Images 2 Video conversion problem ??
I got folder full of images , number of images = 600 , I want to make a video which plays one image

pageination not working right... coping images over 4 pages
Code: <?php //This code will obtain the required page number from the $_GET array. Note that

Menu restriction
How can I restrict the individual menu that would appear when a user logs in so that all users are c

php file erros / need help please
Hello

Someone decoded a zend file for me.. after uploaded it on ftp i get some errors, i trye

help with multi-update
Now sure how to ask this really....
10g database if that matters.

I have a customer

Weird problem with SELECT command..Help!
Hi!

It seems I'm having a really weird problem with SQL SELECT command....I have table into a

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