A
A
Andrey2017-09-29 10:43:27
Ruby on Rails
Andrey, 2017-09-29 10:43:27

How to pass a variable using the POST method?

CDEK's documentation says:

To use it, you need to send a POST request to the URL: <server>/new_orders.php, for example, https://integration.cdek.ru/new_orders.php with the $_POST['xml_request'] variable filled in, in which the contents of the XML file are transmitted.

And then there is the description of the data.
DeliveryRequest
Number 
Date
Account
Secure
OrderCount

I do not quite understand what needs to be transferred in the end. Should I generate an xml file? Or in the form of a url, you can pass parameters (whereas it should look like)?
Documentation: www.edostavka.ru/website/edostavka/upload/custom/f... (For integration)
- Data exchange format "SDEK" - Online Store
- Section 3 (list of delivery orders)
I just want to understand how it is should it look like in the end?
https://integration.cdek.ru/new_orders.php?xml_request=(и что тут нужно указать?)
like or how?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Karim Kyatlottyavi, 2017-09-29
@constXife

Looks like this.

require 'net/http'

xml_file_content = File.read("xml_file.xml")
uri = URI('https://integration.cdek.ru/new_orders.php')
res = Net::HTTP.post_form(uri, 'xml_request': xml_file_content)
puts res.body

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question