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

Spaghetti Code
So.

I've pretty much reached the point where I have so many isset s on one page that I can't

strptime() equivalent for php4 ?!
Greetings!

this is my first post, thank you in advance for your replies.

Well, the ti

Secure pages Sessions vs. Cookies & session_destroy() help
Im new here and new to PHP, I hope you can help me with some questions.

Im writing my web ap

dinamic "textboxes"?
Ey all, my first post here, i hope its not a hard one

I display mysql results in a table

How to sum these output values
Hi

I need sum the month totals
SELECT region_name, area_name ,SUM (CASE WHEN S

How To Make More Than One Redirection with PHP on the same page?
Hey im trying to do a direction page where it open differently link direction pages every time som

How to give the privillege for triggers?
Hi,

How to give the privillage for triggers to particular user?

Please let me

How would I do "Users not logged in since *** delete them"
I know how I would set this up, and delete the user roughly.
I'll create a table called "Use

Amatuer requiring assistance
Beginner and amateur in need of assistance

My Site - (Spare Parts for Domestic Appliances)

[PHP HELP] Php order form.
Hello to everyone @ phpfreaks. Im new to this site and hope to learn lots of things here.

Fir

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