Hi,
I want to use HTTP with method POST. The default method GET is correct the server return data but with the method POST it’s impossible no server request and of course no reponse !
what’s wrong ? Have you any idea ?
My device is a Q2686 with a 6.62firmware and wip_IP_lib 3.00.06
//----------------------------------------------------------------------
wip_channel_t http;
static char urlBuff[256];
//----------------------------------------------------------------------
u8 http_OpenSession( const char *pURL ) // Try to open session
{
// setup HTTP session
http = wip_HTTPClientCreateOpts(NULL, NULL,
WIP_COPT_HTTP_HEADER, "User-Agent",
"WIP-HTTP-Client/1.0", WIP_COPT_END);
// Get Html page
wip_getFileOpts( http, "http://<server>...", http_event, NULL,
WIP_COPT_HTTP_METHOD, WIP_HTTP_METHOD_POST,
WIP_COPT_HTTP_HEADER, "Accept", "text/html",
WIP_COPT_HTTP_HEADER, "Content-Type", "application/x-www-form-urlencoded",
WIP_COPT_END);
return 0;
}
//----------------------------------------------------------------------
void http_event( wip_event_t *ev, void *ctx )
{
wip_channel_t ch;
u8 buf[128];
s32 ret;
int wrt;
// Get originating channel
ch = ev->channel;
switch(ev->kind)
{
case WIP_CEV_OPEN:
// Get status code
TRACE((1,"##HTTP Open"));
break;
case WIP_CEV_READ:
TRACE((1,"##HTTP READ!"));
// Read Data from server
while((ret = wip_read(ch, buf, sizeof(buf)-1))>0)
{
buf[ret]='\0';
dial_reponse(buf);
}
break;
case WIP_CEV_WRITE:
wrt = wm_sprintf(buf,"IMEI=1&Ref=0\r\n\r\n");
// Write POST argument to HTTP request
wrt = wip_write(ch, buf, wrt);
TRACE((1,"##HTTP WRITE for Post[%x]",wrt));
wip_shutdown(ch,FALSE,TRUE);
case WIP_CEV_PEER_CLOSE:
wip_close(ch);
break;
case WIP_CEV_ERROR:
wip_close(ch);
break;
}
}
Thank you in advance for your help.