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
Form submissing with PHP and JQuery/Ajax
I have searched everywhere, but cannot find a solution for this... I have worked all day trying to g
Target costs on Process orders not calculating
Hi All,
We have released standard costs for all the materials. We have also done Goods r
Mail from PHP form not always ending up in my inbox?
Hi guys,
I'm a real newbie to PHP and have managed to put together a simple mail form that se
Accept only alpha characters
I've got this bit of code ready for accepting a phrase:
Code: if (!eregi ("", $_POS
Multi Level Array Problem
hi all,
For example I have array like below:
$temp = array(array('north america', 'us'
need to add "sizes" to shopping cart
Hey guys, I am trying to figure out a way to add a "size" selector on to this bit of code.
Loop column after 2 results
Hello All.
Here is what I have:
Client ID Company name Clien
iMatch stored value with the current value in a loop
Hello,
I have a MySQL db were I store articles in.
I have a form to fill these article
switch not getting value
what am i doing wrong?
i want to populate the country list according to the category
i want to
form help
this doesn't work. i want the form action to go the location.href of the submit button chosen.. how