Jump to content

curl


zipp

Recommended Posts

Here's my interpretation.

 

You want page1.php to continually add the output of page2.php onto page1. If that's what you want, there's no "proper" way to do it with PHP alone. If you include it or even do readfile (btw, readfile will get you the code, not the result of the code) it won't update continuously. It'll just take its time, finishing the loop, before the user sees anything (unless you have output buffer off, or you're forcing the output buffer to flush, which you are). But it will NOT continue to load the rest of the page until that code is done. And my assumption is you want page2.php to run independently of page1.

 

Let me try to summarize it (in case the above is confusing): you want page1 to load completely, done, and for it to load the result of page2 somewhere into page1 continually.

 

I hope I'm not being confusing. Anyway.

 

The best way you may want to approach this is a mix of PHP and javascript/AJAX. Use AJAX to continually poll page2.php and print the result into page1.php.

Link to comment
https://forums.phpfreaks.com/topic/96076-curl/#findComment-491920
Share on other sites

You'll want to start ground up with Javascript and AJAX. If you're adept in PHP, javascript should come to you fairly quickly. You don't even need to take on javascript entirely to grasp AJAX. But I'd suggest it. If the page2.php you provided is all you want it to do, you can just do that in javascript without PHP at all.

 

Good PHP/AJAX tutorial:

http://www.ajaxf1.com/tutorial/ajax-php.html

 

Other references:

Javascript Tutorials:

http://www.tizag.com/javascriptT/

 

AJAX tutorials

http://www.tizag.com/ajaxTutorial/

Link to comment
https://forums.phpfreaks.com/topic/96076-curl/#findComment-491938
Share on other sites

I'm not a big fan of frames either, but I'm trying all my options here.

 

What i am actually making is... not sure what you would call it... it pings a server 10 times, then averages the pings to get the "average ping time"... the first ping always works... here is what it looks like

 

0.0607 seconds  <-- normal

0.0057 seconds  <-- crazzy

0.0577 seconds  <-- normal

0.0041 seconds  <-- crazzy

0.0034 seconds  <-- crazzy

 

etc...

 

So I'm completely loss on this...

 

It only stopped working when I started using iframes.

Link to comment
https://forums.phpfreaks.com/topic/96076-curl/#findComment-491974
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.