I'm trying to get the echoed $data which has the class name 'daniweb' in it to return in var temp, however even though $data is echoed, its technically not part of the document. Any ideas? Thanks in advance!
5 Months Ago
Related Article:file_get_contents then write to text file
is a solved PHP discussion thread by reco21 that has 2 replies, was last updated 8 months ago and has been tagged with the keywords: php, file_get_contents, fwrite, ftp.
If you paste the contents of the $data var, it might shine some light on this. As for the position of the script, I've moved to placing nearly everything just before the closing </body> tag of the html - far less hassle that way.
however even though $data is echoed, its technically not part of the document
Why not? Whether it's generated by php or 'hard markup' it should still be valid html when it leaves the server - indistingushable form one another.
the order of the script does make difference, if you don't use events to run it. If the script is run before the DOM is created then the elements doesn't exists yet, therefore the method getElementsByClassName() won't find any elements.