1

Hi Is it possible to parse HTTP get/post requests using tcpserver in MATLAB? I followed this link but it seems it's not possible. Does anyone know what can be done in this case? When I send a Http request, I see the string data being recieved by the server but it seems to me that I might have to write my own parser. Has anybody encountered such situation?

Ajx
  • 53
  • 1
  • 5

1 Answers1

1

The Matlab tcpserver function just does TCP/IP. That's a lower-level network protocol; it doesn't support the higher-level HTML protocol/data format.

There's an htmlTree function in the Matlab Text Analytics Toolbox if you want to pay $1,000 for that. There's no HTML parser in core Matlab.

But Matlab has an embedded Java JVM, so you can use Java libraries in Matlab code, and there's free and open-source Java HTML parsing libraries, like Jsoup. You can pull one of those in by sticking its JARs on your Matlab's Java classpath (using javaaddpath(...)) and script it with M-code.

Or do the same with a Python HTML parsing library using Matlab's Python External Interface API.

If you decide to write your own HTML parser in Matlab, you are going to be sad. :(

Andrew Janke
  • 23,508
  • 5
  • 56
  • 85
  • “you are going to be sad” — I have never attempted to write an HTML parser, but I can certainly imagine this to be true. – Cris Luengo Dec 11 '21 at 18:27