H
H
hitakiri2014-05-13 13:30:51
PHP
hitakiri, 2014-05-13 13:30:51

How to transfer from MS Excel to remote server with PHP?

Good time, I transfer data from excel to the server, below is an example

Private Sub btnStart_Click()

Dim XMLHTTP As MSXML2.XMLHTTP, step As Integer, flag As Boolean
Set XMLHTTP = New MSXML2.XMLHTTP
step = 1: flag = True
Do
    XMLHTTP.Open "POST", "http://site.ru, True
    XMLHTTP.SetRequestHeader "Host", "http://site.ru"
    XMLHTTP.SetRequestHeader "Content-type", "application/x-www-form-urlencoded"
    XMLHTTP.SetRequestHeader "Cache-Control", "no-store, no-cache"
    XMLHTTP.SetRequestHeader "Pragma", "no-cache"
    XMLHTTP.SetRequestHeader "User-agent", "Mozilla/5.0 (Windows; U; Windows NT 6.0; ru; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 ( .NET CLR 3.5.30729)"
    zapros = 121416
    postr = 963
    XMLHTTP.SetRequestHeader "Content-Length", CStr(Len(zapros))
    XMLHTTP.send postr
    Do While XMLHTTP.readyState = 10
         DoEvents
    Loop
    step = step + 1
    If step > 4 Then flag = False
Loop Until flag = False
XMLHTTP.abort
Set XMLHTTP = Nothing

End Sub

And accept it php -
$post = $_POST['121416'];
echo $post ;

Tell me, please, where is the error?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrew, 2014-05-13
@hitakiri

It seems to me that it is necessary to send in the body of the HTTP-Body the pairs "VARIABLE_NAME" "=" "VARIABLE_VALUE", i.e.
And then on the receiving side this value will be available through
$_POST['param1']

M
m-haritonov, 2014-05-13
@m-haritonov

You can get the body of a POST request in its pure form in PHP as follows:
If you want to send "name=value" parameters, then you need to do as @OLS wrote .
PS: why do you send the value of the postr variable in the body of the POST request, and specify the length of the zapros variable in the content-length?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question