Clear a specific area of ​​site content Using secure login

I'm trying to clear some specific text of a website that is connected to the system here is a lesson on this use curl http://www.digeratimarketing.co.uk/2008/12/16/curl-page-scraping-script/

But I can’t implement this in my code words here is my curl script

$url = "http://aftabcurrency.com/login_script.php";

$ch = curl_init();    
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 

curl_setopt($ch, CURLOPT_URL, $url); 
$cookie = 'cookies.txt';
$timeout = 30;

curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_TIMEOUT,         10); 
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,  $timeout );
curl_setopt($ch, CURLOPT_COOKIEJAR,       $cookie);
curl_setopt($ch, CURLOPT_COOKIEFILE,      $cookie);

curl_setopt ($ch, CURLOPT_POST, 1); 
curl_setopt ($ch,CURLOPT_POSTFIELDS,"user_name=user&user_password=pass&passcode=code");     

$result = curl_exec($ch); 
curl_close($ch); 
$source = $result;
if(preg_match("/(CC3300\">)(.*?)(<\/font>)/is",$source,$found)){
echo $found[2];
}else{
echo "Text not found.";
}

e.g. at aftabcurrency.com. I only want to refuse only "Our services"! (this text changes every day)

0
source share
1 answer

what I would do is “cut” the text between the beginning and the beginning ... in the source text, the text starts with the color of the text 613A75 and with the closing </font> Here is a regex solution:

$source = file_get_contents("http://aftabcurrency.com/index.php");
if(preg_match("/(613A75\">)(.*?)(<\/font>)/is",$source,$found)){
echo $found[2];
}else{
echo "Text not found.";
}

-, $source = file_get_contents... $source = $result

: DomDocument xpath strpos/strstr/substr php.

+1

All Articles