通过 cURL 登录 Javascript 页面?

发布于 2024-08-12 00:34:06 字数 496 浏览 1 评论 0原文

我在设计一个尝试使用 cURL 登录计费门户 (Freshbooks) 的脚本时遇到了一些麻烦。我在网上看到了各种这样的例子(http://www. trap17.com/index.php/automatic-login-curl_t38162.html)但是,这些示例都不会使用 JavaScript。

登录页面似乎是基于 JavaScript 和 jquery。谁能给我指出一个有用的例子吗?我的目标是通过 cURL 向此页面提交登录信息,并在登录正确与否时收到响应。

以下是登录页面示例:https://trustxbeta.freshbooks.com/

谢谢

I'm having some trouble devise a script which attempts a login to a billing portal (Freshbooks) using cURL. I've seen various examples of this online (http://www.trap17.com/index.php/automatic-login-curl_t38162.html) however, none of these examples would with JavaScript.

The login page seems to be based on JavaScript and jquery. Can anyone point me to a helpful example? My objective is to submit via cURL login information to this page and receive a response if the login is correct or not.

Here is an example login page: https://trustxbeta.freshbooks.com/

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦亿 2024-08-19 00:34:06

您想要做的是使用 Firebug 仔细查看网络流量。我确信您有一些帖子需要处理。 cURL 可以处理用户名和密码以及 SSL 身份验证。您只需确保所有设置都正确即可。

我看了你的例子。有一个帖子看起来像这样:

Submit  Login
forgotten   
invitation  
javascriptDisabled  0
password    hadafarm
username    OldMcDonald

我不确定当你真实登录时会是什么样子(我的虚构帐户无法让我登录)。

您还需要查看标头并确保所有这些设置正确(编码等)。

What you want to do is look very carefully at the network traffic with Firebug. I'm sure you have some posts to deal with. cURL can handle usernames and passwords and SSL authentication. You just have to make sure you get all the settings just right.

I looked at your example. There is a POST that looks like this:

Submit  Login
forgotten   
invitation  
javascriptDisabled  0
password    hadafarm
username    OldMcDonald

I'm not sure what it looks like when you log in for real (my made-up account failed to get me in).

You'll also want to look at the headers and make sure you get all those set right (encoding and such).

梦里人 2024-08-19 00:34:06

您可以在 IE 上使用 FiddlerTamperDataFirebug ( net) 在 Firefox 上,检查器 ChromeSafari,或任何浏览器的代理,以观察表单如何提交“普通”浏览器。然后,您将使用可用于curl 的多个参数重新创建查询字符串和任何发布数据。 Curl 甚至可以将一个请求中的 cookie 存储在文件中,直到下一个请求需要它们为止,我发现这非常有帮助。

You can use Fiddler on IE, TamperData or Firebug (net) on Firefox, the inspector on Chrome and on Safari, or a proxy with any browser to watch how the form is submitted by a "normal" browser. You'll then recreate the query strings and any post data with the multitude of parameters available to curl. Curl can even store cookies from one request in a file until they're needed for the next request, which I've found very helpful.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文