Below code shows how to check XML element by preg_match
function crcExists($crc32) { $fp = @fopen( "./crc32.xml", "r"); if ($fp) { while( !feof($fp)) { $buff = fgets($fp, 10240); $buff = trim($buff); echo $buff . "\n"; $buff=str_replace("\n", "", $buff); if (preg_match("/\<crc32\>" . $crc32 . "\<\/crc32\>/", $buff)) { echo "url found<br>"; return true; } } fclose($fp); } return false; }