cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: HTTP Status 400 - Invalid direct reference to form login page

From: sklosek <sklosek_at_o2.pl>
Date: Thu, 01 Feb 2007 13:53:49 +0100

Hi
I did try that one but with no result

What am I doing wrong?

If i post the start file i will get the same page again.

$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, "MSIE 6.0; Windows NT 5.0");
curl_setopt($ch,
CURLOPT_URL,'https://212.XXX.XXX.XXX/dir/Start');
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookies.txt");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,FALSE);
curl_exec ($ch);
curl_close ($ch);

$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, "MSIE 6.0; Windows NT 5.0");
curl_setopt($ch,
CURLOPT_URL,'https://212.XXX.XXX.XXX/dir/j_security_check');
curl_setopt($ch, CURLOPT_REFERER, 'http://212.XXX.XXX.XXX/dir/Start');
curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookies.txt");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,FALSE);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch,
CURLOPT_POSTFIELDS,"log_button=Login&j_username=username&j_password=password");
curl_exec ($ch);
curl_close ($ch);

Dnia 01-02-2007, czw o godzinie 13:02 +0100, Daniel Stenberg napisał(a):
> On Thu, 1 Feb 2007, sklosek wrote:
>
> > The code below, doesn't work i tried everything else ...
>
> If you tried *everything* then I guess it is impossible.
>
> Otherwise I would bet my money on that you need to get at least the page that
> olds the form first and gather cookies before you can submit the post.
>

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2007-02-01