1

我是 stackoverflow 的新手,所以如果对此有任何疑问,请不要打扰我。

所以我想使用 libcurl 登录一个网站,这是我从网站上得到的代码片段(关于需要的 2 个输入框):

<input type="text" name="vb_login_username" id="navbar_username" size="15" accesskey="u"             tabindex="96" value="Username" onfocus="if (this.value == 'Username') this.value = '';">
<input type="password" name="vb_login_password" id="navbar_password" size="15" tabindex="97">

我应该如何实施这些?我尝试使用以下代码片段,但我不确定这是否有效,因为我没有收到来自 lib 的答复。(仅包括必要的代码)

data="vb_login_username=test&vb_login_password=test";
curl_easy_setopt(myHandle, CURLOPT_URL, "http://www.somesite.com/login");
curl_easy_setopt(myHandle, CURLOPT_POSTFIELDS, data);
res[0] = curl_easy_perform( myHandle );
4

0 回答 0