开发者

PHP cURL post to a form that is being processed by jQuery?

开发者 https://www.devze.com 2023-02-20 02:01 出处:网络
Ok, so usually I would lookup the form\'s action attribute (e开发者_StackOverflow中文版x: request.php) and would do a cURL post request to that page, but what if the form is being processed by jQuery?

Ok, so usually I would lookup the form's action attribute (e开发者_StackOverflow中文版x: request.php) and would do a cURL post request to that page, but what if the form is being processed by jQuery? Example

<form method="post" action="profile/post/USERNAME" id="postForm"
    onsubmit="funct.post('USERNAME'); return false;" >
...
<input type="button" class="sendButton" id="sendBtn" value="Send"
    onclick="funct.post('USERNAME')" />

I have no idea how to work with this form, I've tried submitting to the /profile/post/USERNAME page, but that doesn't work. Am I missing something?


Actually, I was having problems because the form is using AJAX to post the form. If looking through MASSIVE, unformatted amount of jQuery code (like in my case) is a problem and doesn't lead anywhere, then a good idea is to look at the headers that are being sent to the server.

I used HTTP Live Headers addon for Firefox to see just that, and noticed that the actual query was token=4324234324&note=My+Note&ajax=1 Both token and note were present in the form, token as hidden and note as text input, but the ajax=1 is inserted somewhere when it's processed by jQuery.

Headers Don't Lie!

0

精彩评论

暂无评论...
验证码 换一张
取 消