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 would I convert this into code using an if statement?
ES equals exam score m equals $mean s equals $total. I already coded my mean and total so I'm not g
gmmktime or mktime
I live in the UK, i am within the GMT (with daylight saving time ie 1 hour difrence between summer a
Procedural to OOP
John Kleijn said that to avoid writing "crappy code", we should learn OOP and common OO pr
help with email script...
hey
I need help with my mail script
when the form on http://www.mcgdesignstudio.com/c
Redirect not working after making a POST/GET
Hi Everyone,
I am a novice in PHP. Here I have 2 pages, one page with a textbox and button an
What is SAP Avatar ?
Hi All,
This G.Satish , my boss asked me to explore on SAP Avatar. I searced in internet
timezone change with date()
so i put all my times for posts in my made from scratch forum(not phpbb3 or sm)
in my mysql db u
UTL File problem
Hi
I have a file in certain path with the following permissions (The file is a dummy file witho
MS are the best!!!
Visit http://www.microsoft.com/australia/windows/default.aspx?h=watch-a-demo and click the massive '
Reditecting pages based on logic
Newbie here, apologies in advance!
I am trying to use the header function to forward one of a