Link to home
Start Free TrialLog in
Avatar of robertybob
robertybob

asked on

PHP new SOAP Client

I have a small PHP file that is used to retrieve data from a 3rd party via SOAPClient process every 10 seconds or so. To do this I have the PHP file loaded each time to trigger another SOAP request. My hosting company says that my site is using extraordinary resources and I wonder what I can do to reduce any strain on the hosting. I have 2 simple questions.

1. The file establishes a 'new SOAPClient' every time it loads but is always the same 3rd party WSDL file. Do I need to do this each time and, if so, does this action require 'closing' at the end of the PHP file (like using mysql_close after accessing a database)?

2. Is there a simpler, more efficient way using PHP SOAPClient to get this data every 10-15secs?

If the answer to no1 is proven to be 'yes - it should be closed' then there is no need for an answer to no2.

Many thanks.
ASKER CERTIFIED SOLUTION
Avatar of virmaior
virmaior
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of robertybob
robertybob

ASKER

Thx Virmaior.

The data would need to be retrieved for very long periods (hours) so I assumed that if the PHP file contains 'sleeps' before running a function to check data again it would never actually finish loading?

The WSDL file will be big but the data pulled fairly concise.

The main query was about the possible closing of SOAPClients so thats useful. I'm currently moving almost all calcs/processing to javascript as opposed to PHP and have the actual PHP flie requested down from 30k to less than 2k so this will certainly help bandwidth issues so will see about resources in time.

I'll close this question in the morning to allow others a bit of time to see it in case anything extra to be added.

Thanks again
I am not sure what you mean by
"The data would need to be retrieved for very long periods (hours) so I  assumed that if the PHP file contains 'sleeps' before running a function  to check data again it would never actually finish loading?"

you stated that
"I have a small PHP file that is used to retrieve  data from a 3rd party via SOAPClient process every 10 seconds or so"

what I am suggesting is that rather than start a new php script every 10 seconds, you use the same script for say 5 minutes to pass data and then start a new one...

...

if ran continuously, it would never finish loading, but by running it for longer than one pull, you could have it keep running and consume less resources.

----

one other question.  how big is the data that you are pulling down?


----

finally, it's not exactly clear to me why the appropriate response would be closing the question as I am answering your question.
Sorry - when I said 'close' that meant accept answer and move on since it seems that the SOAPClient is coded correctly......

Whilst the file is small and the retrieved data per request is small, the data would be required to be retrieved every 10sec or so for 8-10 hours minimum every day. I can see if it would be possible to run the same file for 10-20 retrievals during each load but might not be feasible - tho is an interesting thought.

The response data from the WDSL is probably not more than 1k in size and in many cases much less.

yeah, maybe your host just sucks?
that's really not that much load.


Thx - will see how it goes with the reduced PHP file size