cdc

As usual, I'm trying to post a form to a site, but it does it through

AJAX

 . Everything I've tried so far does not work.  Applause

Here's the pieces of the header that look suspect to me when I POST successfully from my browser:

quote

Accept: text/

javascript

 , text/html, application/xml, text/xml, */*
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: close
X-Requested-With: XMLHttpRequest
X-Prototype-Version: 1.5.0_rc0
Content-Type: application/x-www-form-urlencoded


When I try to do it my "traditional" way it just comes back and says that I need a

JavaScript

  enabled browser to submit the form.

Any idea how to get

PHP

 /cURL to handle this?

perkiset

quote author=cdc link=topic=201.msg1257#msg1257 date=1178981895

As usual, I'm trying to post a form to a site, but it does it through

AJAX

 . Everything I've tried so far does not work.  Applause

First off C, I need to question your intentions here: you don't POST a form via

ajax

  - you can send a

ajax

  request with a post-type message, but not post a form... is this what you mean?

Second - are you using the

Ajax

 Requestor class in the

javascript

  repository or are you just doing this by hand?

quote author=cdc link=topic=201.msg1257#msg1257 date=1178981895
Here's the pieces of the header that look suspect to me when I POST successfully from my browser:

Accept: text/

javascript

 , text/html, application/xml, text/xml, */*
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: close
X-Requested-With: XMLHttpRequest
X-Prototype-Version: 1.5.0_rc0
Content-Type: application/x-www-form-urlencoded

Doesn't look bad to me except that there's no content or content size after those headers...


quote author=cdc link=topic=201.msg1257#msg1257 date=1178981895
Here's the pieces of the header that look When I try to do it my "traditional" way it just comes back and says that I need a

JavaScript

  enabled browser to submit the form.

Who "says" that? Is it IE/your browser giving that message? Is

PHP

  actually creating that message and sending it back? Need considerably more snippets and such to make heads or tails of this...

/p

cdc

Sorry for the confusion.

I'm trying to automate submitting a form on a third party site. The third party site uses (from what I can tell)

AJAX

  to haul my data back to the server when I push the submit button. I think that's what

X-Requested-With: XMLHttpRequest

is telling me anyway.

When I look at what cURL is returning, it's a message saying, "Sorry, you need

JavaScript

  enabled to submit forms." This is the third party site telling me this. I get the same message if I copy the URL and post fields from the headers and paste them into my address bar.

Hopefully this makes more sense...

perkiset

PMing you now...

thedarkness

I'd say there are two possibilities here if they are using

AJAX

  for their form "submission". One is to dismantel their XMLHttpRequest and try and post this directly from your program, this will only work if they are not restricting access to their server. Further explanation, lets say that they are posting using GET as follows;

http://their.server.com?name=fred&eaddress=fred@dag.com&dollars=1000

Theirs nothing stopping you technically from hitting that link from anywhere unless they have secured it in some fashion (prolly fairly likely, although.....) Same goes if it's using POST although a level of magnitude more difficult.

If you cannot use the first method then you need to look at some form of browser automation such as using MS's webbrowser object or shdocvw (both automating IE). Easy enough to do if you know how, non-trivial otherwise.

If you want some tips on option two, PM me and I'll give you any help I can.

Cheers,
td

cdc

Yeah, it looks like I'd have to go with option 2 because if I just post the variables the server comes back and says that I need a JS enabled browser, so something else is going on with this.

It's not worth going the extra mile for. There are plenty of other <>sites to spam fish in the sea.


Perkiset's Place Home   Politics @ Perkiset's