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
34
Other forums
What exactly is net neatrality?
What exactly is it? I think it's anti-censorship and... stuff... but I don't really understand it
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
Displaying image from database
Hi,
I've got a site where that's got a database behind it. Currently it has loads of items in
Multiple Options for a Single Page
For this example I want to use the Handlers option which is under Fed Admin and all the related codi
php or sql?
Sorry not sure if this is a sql problem or php the following code is supposed to delete data from th
Cannot Connect to Database
I am writing an application to do annual reviews. I cannot get my script to work. Whenever it runs I
bind error during socket programming
i am kinda new to socket programming. wrote the below code for a server. but getting the bind error
Strange cookie problem. setcookie dependant on where user was directed from?
Hello,
I have a website that sets a cookie when a user visits the website. The cookie holds a
How to calculate days from variable date?
This will be easy for one of you gurus. I want to fetch the date from a variable date, for example:<
Parse XML
Good day,
I use oempro software and try to parse XMLReturn but it's not working for me, simpl