[Urgent]
Hi ,
I am trying to extract text from a website using file_get_contents('url'),no issues with that.
Thing is that I am not getting expected output of it..And the reason I see is that ,if the url is generally opened,first home page flashes and while the page is still loading another/final set of information is displayed. So,final information is only displayed once the page is finally loaded.While the file_get_contents() function returns initial text/content of the website...
What all can be done,such that file_get_contents('url') extracts data only and ONLY after page stops loading and is fully loaded. I think a function like onpageload etc does not exist in PHP,not sure.. Please guide me with tips/code snippets/links etc .. Any help will be greatly appreciated.
In short,I want the content of website,only after its fully loaded and want the file_get_contents('url') execute only after 'url' is fully loaded. Thanks
Thanks a lot.Please let me know,if any part of the problem statement remains unclear.Thanks again..
Recommended Answers
Jump to PostIf you stick the file_g..... function at the top of your script in a variable then it should be loading the code before you echo it out.
The issue comes as your are essentially loading two websites.
Maybe this website has a longer response or load time.
…
Jump to PostIf you stick the file_g..... function at the top of your script in a variable then it should be loading the code before you echo it out.
The issue comes as your are essentially loading two websites.
The
file_get_contents
function halts the execution of the PHP script until after the …
Jump to PostIn that case URL include. That works as it loads all of the scripts before the the document is loaded INCLUDING client side scripts.
BEFORE everyone says they cant do that or whatever because their host has barred it, then shhhhh.
The host do not EVER ban anything …
All 12 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.