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
How do I know when getBounds Method is ready to be called.
I have an application that changes out stylesheets client side. Once I change stylesheet the browse
Using CSS to format MySQL query
Hi,
If i want to have a news page on my site, which displays all records of a table in descen
DateObject and Nulls
Hi all,
I have an array mapped to a value object. One of the items in the array is a PHP Date
Help with form post data and arrays
Hi all,
I am new to this forum... It has been awhile since i have worked with arrays, and i a
Displaying image pathname instead of image
Hello
Im trying to upload and then display images from a mysql database - Its only basic and
Sum of Values in an Array
This is probably really simple... but it's been years since I've written anything, so bare with me!<
url- go to webpage
i have an input text field and submit button.
how do i make the url entered into the textfiel
preg_replace question
Hello!!
I hope someone can help me with preg_replace.
I load two tables from an extern
Help with php code
Hello, can anyone tell me why this php word trap fails to work,
and the trigger words get blow r
Navigation include for all site directories
Hi,
I need a navigation include that can deal with directories at different levels on a site.