Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-09-2006, 12:42 PM   PM User | #1
X-Piral
New to the CF scene

 
Join Date: Feb 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
X-Piral is an unknown quantity at this point
Arrow PHP and XML speed problem

Hi everyone. I am building a website that performs some requests to another server, retrieves the information and then displays it. The requests are made with XML files that are dynamically created from my page. My website works like this:

There is one page with a form where the user must enter the search criteria. Then the form posts the user entered data to another webpage.

The second webpage puts them into an XML, posts it using cURL and stores the response into a string variable. The variable then is parsed with PHP’s simple XML and echoes them.

The problem is that went the second page loads, the status bar say that the page is loaded while the page seems blank. After a while the page starts to load again and the displays the retrieved data. I tried to find out why this happens and I erased everything except from the XML that is posted and the cURL code that posts it and assigns the response to a variable, so I came up with the conclusion that cURL is responsible. The XML that I send is about 15 to 20 lines long and it’s well formatted so I don’t think the XML is the problem, but the response XML might be huge depending on the search data entered.

Can anyone tell me how to fix this problem or how to display a “Loading…” or something while the page seems blank? I’m sorry for the huge post. Thanks in advance!
X-Piral is offline   Reply With Quote
Old 02-09-2006, 03:40 PM   PM User | #2
raf
Master Coder


 
Join Date: Jul 2002
Posts: 6,589
Thanks: 0
Thanked 0 Times in 0 Posts
raf will become famous soon enoughraf will become famous soon enough
is the result displayed in a table (an html table)?
__________________
Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html
raf is offline   Reply With Quote
Old 02-09-2006, 03:52 PM   PM User | #3
X-Piral
New to the CF scene

 
Join Date: Feb 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
X-Piral is an unknown quantity at this point
Hi. Thanks for the reply. I echo a table. Inside the table there are some variables to output the the results i parsed with simple XML from the response XML. The table i repeated in order to display all the results. I stored the response XML in a file and parsed it localy to see if the parser is my problem but i had no delay. When i receive a response from the remote server i have a different delay time every time i make a new query. I think my code and the XML i send are well writen. What could be the problem? Thanks again!
X-Piral is offline   Reply With Quote
Old 02-09-2006, 04:01 PM   PM User | #4
raf
Master Coder


 
Join Date: Jul 2002
Posts: 6,589
Thanks: 0
Thanked 0 Times in 0 Posts
raf will become famous soon enoughraf will become famous soon enough
is it a large table? because a table will only be displayed when it's completely loaded into the browser. first the browser will load the complete code for the table and usually will then rerender the page (which you can see sometimes when the pages stretches etc)

Maybe the problem is that the content isn't streamed quick enough to the client and/or rendered fast enough by the browser.

try just echoing out the response, without putting it into a table. You might then get a page that starts displaying content as soon as html code is received (depending on what browser you use, of course)
__________________
Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html
raf is offline   Reply With Quote
Old 02-09-2006, 04:10 PM   PM User | #5
X-Piral
New to the CF scene

 
Join Date: Feb 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
X-Piral is an unknown quantity at this point
I deleted everything and left only the curl function that posts the XML and i echoed the response XML but i had a delay once more. There are only 40 lines of code left. I don't think that this is the case. Thanks for the quick reply.

Last edited by X-Piral; 02-09-2006 at 04:23 PM..
X-Piral is offline   Reply With Quote
Old 02-09-2006, 04:28 PM   PM User | #6
raf
Master Coder


 
Join Date: Jul 2002
Posts: 6,589
Thanks: 0
Thanked 0 Times in 0 Posts
raf will become famous soon enoughraf will become famous soon enough
did you try echoing the microtime at strategical positions in your code to get an idea on the duration of each step?

code for a timer --> http://www.codingforums.com/showthre...timer+function
__________________
Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html
raf is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:12 PM.


Advertisement
Log in to turn off these ads.