...

View Full Version : cant find word in string



surreal5335
01-27-2012, 11:51 PM
I am using preg_match to search html for a particular string

I have checked and the html is loaded into the variable I need. Currently I am using this syntax to retrieve the word but all I get is 'Array()' with a print_r



$viewResponse = htmlspecialchars($response);


$pattern = '/^confirm/';

preg_match($pattern, $viewResponse, $matches);


ideally I need to get the long alphanumeric string which follows after '&confirm='

But for now I am trying to get some response from preg_match

Any ideas?

jmj001
01-28-2012, 04:52 AM
perhaps a diff approach would work


$viewResponse = htmlspecialchars($response);
$respParts = explode("&",$viewResponse);
$j = count($respParts);
for($i = 0; $i < $j; $i++){
if(strpos($respParts[$i],"confirm=")){
echo substr($respParts[$i],8);
}
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum