simonmlewis wrote:You little genius.
It's take a week or two to crack this - and that is EXACTLY it.
Can you please talk me through what:
Code: Select all
if(strpos($contents, "Not Currently Available") !== false)
.. means, in case I need this sort of thing again?

http://www.php.net/strpos/
Essentially, I'm just using strpos() (string position) to determine whether or not the text "Not Currently Available" is in $contents or not. $contents contains the Javascript received from $url.
strpos() returns an index if it finds the text.. of the starting position of the text. If it is NOT found anywhere, it returns false. I used the "identical to" (or rather, NOT identical to) operator to test accurately against false... using != instead of !== could cause problems.
With $foo != false... $foo = 0 is false, $foo = false is false.
With $foo !== false... $foo = 0 is NOT false, $foo = false IS false.
So anyway... we were just checking to see if "Not Currently Available" was in there... if it was, say not available.. if it wasn't.. it's available. Hope it helps.