http://api.map.baidu.com/ag/coord/convert?from=0&to=4&mode=1&x=106.504468&y=29.590220
如何请求上面的url?

解决方案 »

  1.   

    HINTERNET hInternet,hConnect,hRequest;
        BOOL bRet;CString strResponse;    hInternet = InternetOpen(_T("User-Agent"),INTERNET_OPEN_TYPE_PRECONFIG,NULL,NULL,0);
        hConnect = InternetConnect(hInternet,"api.map.baidu.com",80,NULL,_T("HTTP/1.1"),INTERNET_SERVICE_HTTP,0,0);
        
    //http://api.map.baidu.com/ag/coord/convert?from=0&to=4&mode=1&x=106.504468&y=29.590220
        hRequest = HttpOpenRequest(hConnect,"POST","/ag/coord/convert?",_T("HTTP/1.1"),NULL,NULL,INTERNET_FLAG_RELOAD,0);
        bRet = HttpSendRequest(hRequest,NULL,0,"from=0&to=4&mode=1&x=106.504468&y=29.590220",strlen("from=0&to=4&mode=1&x=106.504468&y=29.590220"));    while(TRUE)
        {
            char cReadBuffer[4096];
            unsigned long lNumberOfBytesRead;
            bRet = InternetReadFile(hRequest,cReadBuffer,sizeof(cReadBuffer) - 1,&lNumberOfBytesRead);
    }
    百度返回参数无效,如何正确填写?