I'm working on a feature which requires me to get the contents of a webpage, then check to see if certain text is present in that page. It's a backlink checking tool.
The problem is this - the function runs perfectly most of the time, but occasionally, it flags a page for not having a link when the link is clearly there. I've tracked it down to the point of visually comparing the strings in the output, and they match just fine, but using the == operator, php tells me they don't match.
Recognizing that this is probably some sort of encoding issue, I decided to see what would happen if I used base64_encode() on them, so I could see if doing so produced different results between the two strings (which appear to be exactly the same).
My suspicions were confirmed - using base64_encode on the strings to be compared yielded a different string from each. Problem found! The problem is, I don't have any idea how to solve it.
Is there some way I can make these strings uniform based on the outputted text (which matches), so that when I compare them in php, they match?