Post message to an URL

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Post message to an URL

Raquel Vieira

Hello.

 

I’m trying to use libWWW to making an aplication in linux that send an HTTP Post to an URL and get the server response. The server only supports he HTTP/1.0 version.

 

I’m doing something like

 

HTProfile_newNoCacheClient("TesteApp", "1.0");

 

request = HTRequest_new();

 

dst = HTAnchor_findAddress("http://172.18.56.60:8080");            -> I don’t want the default http port (80) but the 8080 port. Can I do this?

 

string data = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><displayMLRequest xmlns=\"http://www.peek.se/DisplayML/\" version=\"1.12\" dateTime=\"2006-04-07T11:04:22\"><setDisplay template=\"FiguraComTexto\"><graphic region=\"Grafico\" name= \"Figura1.xpm\" /><textField region= \"Texto\" align=\"left\" >RAQUEL </textField><textField region=\"Time\"><time format=\"hh:mm\"/></textField></setDisplay></displayMLRequest>\")"; 

 

src = HTTmpAnchor(NULL);

 

HTAnchor_setDocument(src, (char*)data.c_str());

HTAnchor_setFormat(src, WWW_PLAINTEXT);

HTAnchor_setLength(src, data.length());    t

status = HTPostAnchor(src, dst, request);

 

I don’t know how can I get the response from the server.

 

Can anyone help me?

 

Thanks in advance,

 

Raquel