Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Linux中使用C++下载密码保护URL?_C++_Linux - Fatal编程技术网

如何在Linux中使用C++下载密码保护URL?

如何在Linux中使用C++下载密码保护URL?,c++,linux,C++,Linux,首先,我不是想侵入任何东西或任何人的电子邮件 我是一名新的软件工程师,我需要登录到公司的维基页面&下载显示在文本文件或其他文件中的信息,这样我就可以搜索我正在寻找的数据,并根据我从维基页面学到的知识进行决策。我有维基页面的用户名和密码,不需要破门而入 问题是,我想不出一个好办法来做到这一点。我用的是C++,操作系统是Linux。 这是我到目前为止所拥有的。这不会发出uer名称和密码。有人能告诉我如何发布usename和密码吗 与任何URL的方式相同 scheme://username:passw

首先,我不是想侵入任何东西或任何人的电子邮件

我是一名新的软件工程师,我需要登录到公司的维基页面&下载显示在文本文件或其他文件中的信息,这样我就可以搜索我正在寻找的数据,并根据我从维基页面学到的知识进行决策。我有维基页面的用户名和密码,不需要破门而入

问题是,我想不出一个好办法来做到这一点。我用的是C++,操作系统是Linux。 这是我到目前为止所拥有的。这不会发出uer名称和密码。有人能告诉我如何发布usename和密码吗


与任何URL的方式相同

scheme://username:password@host/path
发件人:


IMHO,最简单的方法是使用curl。Curl是一个比wget更复杂的web客户端


根据您的需要,最好的方法可能是基于Boost的cpp netlib

我试图访问的主机原来是3级安全服务器,不喜欢我所做的。有办法解决这个问题吗?在命令中添加-debug-verbose,并在原始问题中发布您看到的内容的抄本。
#define MAX_CMD_LENGTH 1000;
char cmdBuffer[MAX_CMD_LENGTH];
/* for sake of demonstration */
char *username = "foo";
char *password = "bar";
sprintf(cmdBuffer, "wget --user=%s --password=%s http://www.cooperateweb.com/wikipage/productpage/FWversions+date", username, password);
char *cmd = malloc(strlen(cmdBuffer) + 1);
strncpy(cmd, cmdBuffer, strlen(cmdBuffer) + 1);
system((const char *)cmd);
free(cmd);
 --user=user
 --password=password
    Specify the username user and password password for both FTP and HTTP
    file retrieval. These parameters can be overridden using the --ftp-user
    and --ftp-password options for FTP connections and the --http-user and
    --http-password options for HTTP connections. 
#define MAX_CMD_LENGTH 1000;
char cmdBuffer[MAX_CMD_LENGTH];
/* for sake of demonstration */
char *username = "foo";
char *password = "bar";
sprintf(cmdBuffer, "wget --user=%s --password=%s http://www.cooperateweb.com/wikipage/productpage/FWversions+date", username, password);
char *cmd = malloc(strlen(cmdBuffer) + 1);
strncpy(cmd, cmdBuffer, strlen(cmdBuffer) + 1);
system((const char *)cmd);
free(cmd);