Re: CURL - what am I doing wrong?
Re: CURL - what am I doing wrong?
- Subject: Re: CURL - what am I doing wrong?
- From: Steve Hayman <email@hidden>
- Date: Thu, 1 Dec 2005 12:00:57 -0500
I think Daniel's right, it's looking for a JSESSIONID cookie, which
your browser would have received on the previous request.
curl can retrieve and resend cookies for you too. You could run curl
twice - once to get the initial page, thus receiving one of these
JSESSIONID cookies, and a 2nd request to submit the form while
including the cookie.
Try something like this. curl's "-c" says to store any received
cookies in a file, and "-b" retransmits them on the next request.
# initial fetch, save cookies received in /tmp/cookiejar
curl -c /tmp/cookiejar 'https://efile.boe.ca.gov/boewebservices/
verification.jsp'
# now post the form, and send along any cookies previously received
curl -b /tmp/cookiejar -L "https://efile.boe.ca.gov/boewebservices/
servlet/BOEVerification" --output "/temp.htm" -d
"account=12121212&type=SALES&button=Submit"
if I do this, /temp.htm is a file that includes what I think you're
looking for, the phrase "Permit Number 12121213 is Not Valid"
On 1-Dec-05, at 11:22 AM, Daniel Jalkut wrote:
Hi Hanaan. I think you should look at the actual headers that are
going out over the wire, and tweak your CURL request to match the
Safari-based request more and more until it works.
For instance, in glancing at the headers included by Safari's POST,
I see that there is a cookie involved. Not sure if this is the
problem or not, but it might be.
This is a black art and it really requires getting comfortable with
monitoring everything at the protocol level. That's a bit harder at
first but ultimately it makes things much quicker than trying to
guess the right solution.
If you didn't check it out the last time I posted about it here,
you might be interested in my write-up on using Curl to fool a site
into thinking you're a web browser:
http://www.red-sweater.com/blog/?p=50
Daniel
On Dec 1, 2005, at 10:25 AM, Hanaan Rosenthal wrote:
Steve,
Thanks so much for looking into it.
The result is the same page with the form on it instead of the
page with the final answer (Valid/Not valid...)
My guess is that they have some form element in a comment that
doesn't show on the HTML source, but is required for successful
submission of the form.
If there are any other ideas out there I would love to hear.
This is not for a paying client, at this point it's just a battle
to get the result and help someone out, and the other side's
server seems to be winning :-(
Thanks,
Hanaan
On Dec 1, 2005, at 9:47 AM, Steve Hayman wrote:
Hi Hanaan. I took a look with "curl -v" to see more detail of
the conversation with the server - the response from the server
has a 302 "Moved Temporarily" in it (with a redirection URL).
Try it with "curl -v ...." and you'll see
HTTP/1.1 302 Moved Temporarily
Location: https://efile.boe.ca.gov/boewebservices/
verification_results.jsp
in the output.
To get curl to follow these redirects, use a -L. You might try
curl -L "https://efile.boe.ca.gov/boewebservices/servlet/
BOEVerification" --output "/temp.htm" -d
"account=12121212&type=SALES&button=Submit"
No idea whether the output makes sense but at least this way you
get something in /temp.htm .
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (Applescript-
email@hidden)
Help/Unsubscribe/Update your Subscription:
40red-sweater.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden