mh, im sending a http post request by this code:

NetSocketAddrINType mySockAddr;

 Char         cpSendBuf[500];
 NetSocketRef mySockFd;

 Err   err;
 UInt16  AppNetRefnum;
 Int32  AppNetTimeout;
 UInt16  myHowMany;
 char  textP[2000];
 char  Buf[255];
 UInt16*  sizeP;
 char  Request[255];
 Char  strX;
 Int32  plongAddress;

 MemSet (textP, sizeof (textP), NULL);

 AppNetTimeout = SysTicksPerSecond() * 10;

 SysLibFind("Net.lib", &AppNetRefnum);
 NetLibOpen(AppNetRefnum, &err);
 mySockFd = NetLibSocketOpen(AppNetRefnum, AF_INET, SOCK_STREAM, 0,
        AppNetTimeout, &err);

 plongAddress = NetLibAddrAToIN(AppNetRefnum, "my.ip.in.numbers");

 mySockAddr.family = netSocketAddrINET;
 mySockAddr.port = 80;
 mySockAddr.addr = plongAddress;

 NetLibSocketConnect (AppNetRefnum, mySockFd, (NetSocketAddrType*)
&mySockAddr,
       sizeof(mySockAddr), AppNetTimeout, &err);

 StrPrintF(cpSendBuf,"POST /myapi.oxp HTTP/1.1\nHost:
www.myserver.de\nContent-Length:%u\n\n", StrLen (Request));

 NetLibSend(AppNetRefnum, mySockFd, cpSendBuf, StrLen(cpSendBuf), 0, 0, 0,
AppNetTimeout, &err);

  WriteLoginRequest (Request);
   StrCat(Request,"\n");

 NetLibSend(AppNetRefnum, mySockFd, Request, StrLen(Request), 0, 0, 0,
AppNetTimeout, &err);

 myHowMany = NetLibReceive(AppNetRefnum, mySockFd, &textP, sizeof (textP),
0, NULL, 0, AppNetTimeout, &err);


 NetLibSocketClose (AppNetRefnum, mySockFd, AppNetTimeout, &err);
 NetLibClose (AppNetRefnum, true);
 return;

hope this helps, regards



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to