NetTalk Central

Author Topic: How to HTTP POST a QUEUE from PHP to a NTWS?  (Read 4319 times)

Wolfgang Orth

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
    • oData Wolfgang Orth
How to HTTP POST a QUEUE from PHP to a NTWS?
« on: September 27, 2018, 05:05:54 AM »
Hello all,

my NTWS expects 5 parameters. The first 4 are STRINGS, the fifth is a QUEUE.

I was asked by a guy, who is going to write a client in PHP, how to get that queue into his request, how this request has to look like. And he wants to do that with JSON. Should be no problem.

This is what the NTWS returns as a manual:

Code: [Select]
Example Request

POST /Abfrage HTTP/1.1
Host: localhost:50000
Accept: application/json
Content-Type: application/x-www-form-urlencoded
Content-Length: length

String 1=value&String2=value&String3=value&String4=value

However, this is, how the SOAP-request looks like:

Code: [Select]
  <soap:Body>
    <MyMethod xmlns="Methoden">

      <String1>value</String1>
      <String2>value</String2>
      <String3>value</String3>
      <String4>value</String4>

      // here comes the fifth parameter
      <PZNrecord_list>
        <PZNrecord>
          <lfdNr>value</lfdNr>
          <PZN>value</PZN>
          <Produktname>value</Produktname>
        </PZNrecord>
        <PZNrecord>
          <lfdNr>value</lfdNr>
          <PZN>value</PZN>
          <Produktname>value</Produktname>
        </PZNrecord>

      </PZNrecord_list>

    </MyMethod>
  </soap:Body>

Can someone point me to, how this can be achieved in PHP? How is that QUEUE posted?

I read http://www.capesoft.com/docs/NetTalk10/NetTalkWebClient.Htm#Post like that I could either stuff the parameter into values *) or send the strings as part of the URL:

url = 'https://localhost?String1=bla&....&String4=bla
net.Post(url) ! should work for the strings. But where is the QUEUE?

There is surely something in PHP for that....

In https://stackoverflow.com/questions/3881293/send-http-post-with-array-php I find an example, where first a small array is composed, then the header, next anotehr array, which seems to hold the entire stuff, which is then blown into the ether. Is my guessing right?


So, if someone could give me a hint - much appreciated!

Thx
Wolfgang


*) I expect CustomerName and Company are identical variables on both sides. Right?
net.SetValue('CustomerName','Charlie')
net.SetValue('Company','Capesoft')
« Last Edit: September 27, 2018, 05:14:26 AM by Wolfgang Orth »