Current location: Hot Scripts Forums » Programming Languages » PHP » On load type function using PHP?

On load type function using PHP?

Reply
  #1  
Old 06-06-09, 08:23 AM
geny geny is offline
New Member
 
Join Date: Jun 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
On load type function using PHP?

[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..
--
$html_in_site = file_get_contents('url');
sleep(10);
echo $html_in_site;
--
Reply With Quote
  #2  
Old 06-11-09, 07:50 PM
=OTS=G-Man =OTS=G-Man is offline
Newbie Coder
 
Join Date: Jun 2009
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
you might look into stream_get_contents()

it has you call fopen() first then it reads the stream from that. And that might allow the page to render first then be read in full

Hope it help.
Reply With Quote
  #3  
Old 06-11-09, 09:08 PM
wirehopper's Avatar
wirehopper wirehopper is offline
Community Liaison
 
Join Date: Feb 2006
Posts: 1,563
Thanks: 2
Thanked 25 Times in 25 Posts
Why are you using file_get_contents to read the page in, then send it to the client?

You could just send the file to the client and wait for a user's action.

PHP will execute the entire script - or until it hits an error, exit, or die - then it will send it to the client.

You get only one page of output at a time.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Php Mail Function Not Working(help!!!!!) bitejones PHP 4 02-23-09 06:29 PM
execute php into javascript function Hagoromo PHP 3 05-23-07 03:19 AM
PHP Help - How do I call this function? INTEL PHP 6 04-02-06 02:59 PM
PHP mail function and Gmail strings6 PHP 8 12-29-05 08:58 AM
PHP Error Fairnie PHP 8 06-26-04 08:15 AM


All times are GMT -5. The time now is 03:12 AM.
vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2 (Unregistered)