R
R
Rodion Gashé2019-03-05 12:57:33
PHP
Rodion Gashé, 2019-03-05 12:57:33

How to send in the body of a post request to api xml through php?

From the rs24.ru documentation:

It is necessary to send a request to the address https://rs24.ru/webservices/rest/XXRSV_I1085_ITEM_... using the POST method with the following parameters:
• Accept value application/xml
• Content-Type value application/xml
• Authorization value 'Basic ' || to_base64(|| ':' || <password>)
is formed by concatenating the string Basic and login ':' password in Base64 encoding.
The request body looks like this:
<GET_Input xmlns:ns=" xmlns.oracle.com/apps/fnd/soaprovider/plsql/rest/X... " xmlns:ns1=" xmlns.oracle.com/apps/fnd/soaprovider /plsql/rest/X... ">
<RESTHeader>
<Responsibility>IBE_FIL_022</Responsibility>
<RespApplication>IBE<
<SecurityGroup>STANDARD</SecurityGroup>
<NLSLanguage>RUSSIAN</NLSLanguage>
</RESTHeader>
<InputParameters>
<P_VERSION>2.0</P_VERSION>
<P_PARAMETER_TBL>
<P_PARAMETER_TBL_ITEM>
<PARAMETER_NAME>P_SITE_USE_ID</PARAMETER_NAME>
<PARAMETER_VALUE8>1 /PARAMETER_VALUE>
</P_PARAMETER_TBL_ITEM>
<P_PARAMETER_TBL_ITEM>
<PARAMETER_NAME>P_ITEM_NUM</PARAMETER_NAME>
<PARAMETER_VALUE>10100</PARAMETER_VALUE>
</P_PARAMETER_TBL_ITEM>
</P_PARAMETER_TBL>
</InputParameters>
</GET_Input>

That's the question - how to pass the request body?
As far as I know, in a post in the body there can only be parameters with a value, i.e. in php you need to do something like this:
curl_setopt_array(
CURLOPT_POSTFIELDS => http_build_query(array(
'xml' => $xml
))
);
How to be?
The support is stupid in a terrible way, they don’t understand the code, there are no examples.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DanKud, 2019-03-05
@zorba_buddha

Just send XML in CURLOPT_POSTFIELDSwithout encoding:

$xml = 'ваш_XML';
.....
CURLOPT_POSTFIELDS => $xml
.....

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question