wininet problem

Discussion in 'Programming' started by ssimon171078, Jan 1, 2010.

  1. #1
    i need to do post Request to website http://example with data :
    __EVENTTARGET=&__EVENTARGUMENT=&ctl00%24ContentPlaceHolder%24rbAdOption=0&ctl00%24ContentPlaceHolder%24ctrlCommonAdForm%24txtTitle=Custom+freelance+programming&ctl00%24ContentPlaceHolder%24ctrlCommonAdForm%24txtContent=Various+projects+available+from+data+entry+to+web+design+%26+Programming.+There+is+no+investments+at+all+for+getting+projects.+Projects+available+%3A.+net%2C+banner+design%2C+Data+Entry%2C+Ajax%2C+Flash%2C+Graphic+Design%2C+Link+Building%2C+Joomla%2C+Linux%2C+Logo+design%2C+Delphi%2C+website+security%2C+Java%2C+Excel%2C+Data+Processing%2C+Visual+Basic%2C+XML%2C+C%2B%2B

    i started to write but i have problem
    #include <windows.h>
    #include <wininet.h>
    #include <stdio.h>
    #include <tchar.h>

    int main(void){
    static TCHAR hdrs[] = _T("Content-Type: application/x-www-form-urlencoded");
    static TCHAR frmdata[] = _T("message=John+Doe");
    static LPCTSTR accept[2]={"*/*", NULL};

    HINTERNET hSession = InternetOpen("MyUserAgent", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
    HINTERNET hConnect = InternetConnect(hSession, _T("http://example.com"), INTERNET_DEFAULT_HTTP_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0,1);
    HINTERNET hRequest = HttpOpenRequest(hConnect, "POST", _T("/post/index.php"), NULL, NULL, accept, 0, 1);
    HttpSendRequest(hRequest, hdrs, strlen(hdrs), frmdata, strlen(frmdata));
     
    ssimon171078, Jan 1, 2010 IP
  2. NeoCambell

    NeoCambell Peon

    Messages:
    456
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Your question is unclear to me. However compare with the example code in this link.
     
    NeoCambell, Jan 2, 2010 IP