M
M
mannerheim2015-10-07 12:51:14
PHP
mannerheim, 2015-10-07 12:51:14

What is the best way to store xml queries in php?

Hello!
A PHP application is being developed that interacts with a web service through XML requests over SOAP. There are quite a few requests. Some are static, some need to be generated on the fly, substituting some data into the request.
The question is how best to organize the storage of XML queries? I myself see two options so far:
1. Store requests in files of the form xml/RequestName.xml. It is necessary to send a request - we read the contents of the file into the variable. If you need to substitute some data, then we use the simplest template engine, such as {MYVAR} and replay {MYVAR} to $myVar.
2. Make a function for each request, such as function xmlRequestName($myVar), in which the XML request template will be written inline and which will generate a request with the necessary data at the output.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivanq, 2015-10-07
@Ivanq

Calling the function is faster - there may be a delay in reading the file. However, editing a file is easier for a stranger. In general, it all depends on the situation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question