Hi, I can read successfully test my xml and a text files separately, but I'm coming into a problem where the variable is possibly being removed or deleted by the time I want to plug it into the bottom of the document. As you can see in the top part of the code "$xmlname" is set to the product name specified in the xml document. In the bottom of the document where I use strpos, and attempt to see if the variable $xmlname is equal to a line in the text document, I can't get it to return true unless I statically put a word in, instead of the variable. Any ideas? <?php $xmlFileData = file_get_contents('datafeed1.xml'); //SimpleXML parser $xmlData = new SimpleXMLElement($xmlFileData); //Retrieving the product name $xmlname = $xmlData->transactions[0]->transaction[0]->transaction_details[0]->transaction_detail[0]->product_name; //Printing first product name print($xmlname); print(' - '); //Retrieving the product price $xmlprice = $xmlData->transactions[0]->transaction[0]->transaction_details[0]->transaction_detail[0]->product_price; //Printing first product price print($xmlprice); print "<br /><br />"; $lines = file('file.txt'); // Loop through array foreach ($lines as $line_num => $line) { echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n"; } $string1 = $xmlname; $file = file_get_contents('file.txt'); if(strpos($file, $string1) !== FALSE) echo 'The file contains the string'; else echo 'The string is not within the file.'; ?> PHP:
change: if(strpos($file, $string1) !== FALSE) echo 'The file contains the string'; else echo 'The string is not within the file.'; to: if (strpos($file, $string1) === false) { echo 'The string is not within the files.'; } else { echo 'the file contains the string'; }