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


Re: curl-and-php Digest, Vol 24, Issue 8

From: Richard Lynch <>
Date: Tue, 14 Aug 2007 14:22:56 -0500 (CDT)

On Mon, August 13, 2007 8:51 pm, Dave Fobare wrote:
> On iehttpheaders: I haven't been able to get the addon to work on
> multiple machines. If there is a Firefox equivalent, I'll give it a
> try.


It works. :-)

You have to open it up and click the checkbox for "capture" or
something like that, and then surf, and it shows you whatever you have
configured it to show you in the rest of the config/setup screens.

> The suggested snippet below did not help. I did implement a number of
> suggestions on the CURL page at
> I inserted the following line to enable redirects:
> curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
> And I also added the following snippet to enable cookies on Windows:
> $cookies = "cookie.txt";
> if ($cookies != '')
> {
> if (substr(PHP_OS, 0, 3) == 'WIN')
> {$cookies = str_replace('\\','/', getcwd().'/'.$cookies);}
> curl_setopt($ch, CURLOPT_COOKIEJAR, $cookies);
> curl_setopt($ch, CURLOPT_COOKIEFILE, $cookies);
> }

Did you make the file "cookie.txt" in the cwd a file that PHP can read
and write?
chmod 660 cookie.txt

Are cookies getting stored in that file?

Are there Cookies in the original FORM page?
(You'll need the LiveHttpHeaders to find out, or you could use wget
--server-response or any other tool to get the raw HTTP response...)

I believe that the RETURNTRANSFER and COOKIE* options don't play well
together, as posted previously.

> Same results on both of my test pages. I'll elaborate on the simpler
> of
> the two login pages:
> Login page URL:
> The input form has just the following fields:
> <form action="login2.cfm" method="post">
> <input type="Text" name="UserID" maxlength="40" size="30">
> <input type="Password" name="Password" maxlength="30" size="30">
> <input type="submit" value=" Log In " class="button">
> And there are no other FORMs on the page. The login2.cfm script leads
> to
> the actual destination page,
> What should I try next?

You are missing this:

$post['submit'] = " Log In ";

It is entirely possible that the login script is EXPECTING that INPUT
from the button, and its lack is making it skip something like:
if (isset($_POST['submit']) && $_POST['submit'] == ' Log In '){
  //do the login

Actually, the default name for a submit button might be "Submit" with
a capital 'S'. It's been so long since I've had an un-named submit
button that I forget... Easy enough to build a form and a script to
test that on your own server.

Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
Yeah, I get a buck. So?
Received on 2007-08-14