简体   繁体   English

CURL PHP AJAX请求

[英]CURL PHP AJAX Request

I'm new to using CURL, but I have successfully got it to submit ordinary forms in the past. 我是使用CURL的新手,但过去我已经成功提交了它以提交普通表单。 I'm working with a website that uses an AJAX Request to perform a login, I can get the form to fill out the username and password but since the login button is actually a link I can't get the form to submit, is there some other way I could login? 我正在使用AJAX请求执行登录的网站,可以获取填写用户名和密码的表格,但是由于登录按钮实际上是链接,所以我无法提交表格,其他可以登录的方式吗?

I actually looked into how users log into the site when javascript is disabled, thinking that they may have offered an alternative login route. 实际上,我研究了禁用JavaScript时用户如何登录该网站,以为他们可能提供了另一种登录路径。 However, the developers responded with the statement that the site is not functional when the user has javascript disabled. 但是,开发人员以用户禁用javascript时该站点无法正常运行的陈述作为回应。 Since this is the case, perhaps this is not even possible with cURL? 既然是这种情况,也许使用cURL甚至不可能做到这一点?

Any advice on how I should proceed would be MUCH appreciated, thanks alot! 非常感谢任何关于我应该如何进行的建议!

Figure out where the AJAX method submits to. 找出AJAX方法提交到的位置。 It might be in the action parameter of a form tag, or it could potentially be buried in javascript somewhere. 它可能在表单标签的action参数中,或者可能被埋在javascript的某个地方。

You could use a firefox extension like FireBug or HttpFox to observe what the browser does when you click the "log in" link. 您可以使用FireBug或HttpFox之类的firefox扩展程序来观察单击“登录”链接时浏览器的功能。 It probably generates some kind of POST request. 它可能会生成某种POST请求。 Examine what that post does, figure out how to send an equivalent request via curl, and you're done. 检查该帖子的功能,找出如何通过curl发送等效请求的步骤,您就完成了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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