简体   繁体   中英

How can I download a file in c++ with parameters not using libcurl

所以我有一个关于如何使用 C++ 示例中的参数从我的网站下载文件的问题:“test.com/test.php?user=name&token=sgdashg”我似乎无法弄清楚我是如何尝试 UrlDownloadFileA 的没有参数的主路径。

 URLDownloadToFile(NULL, "localhost:8080/test.php?", "username=" + UserNameBuffer, "&token=" TokentBuf, "C:\\", 0, NULL);

You need to build the full URL as a string before you pass it to the second argument of the function.

So something like this:

std::string url = "localhost:8080/test.php?username=";
url = url + UserNameBuffer + "&token=" + TokentBuf;
URLDownloadToFile(NULL, url.c_str() , "C:\\test.txt", 0, NULL);

The concept of HTTP parameters has nothing to do with the concept of function parameters for the URLDownloadToFile function.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM