cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: POST not working

From: Joseph Glass <glassjos_at_msu.edu>
Date: Thu, 10 Jul 2003 08:24:11 -0400

Hi Ralph,

Thank you for noticing that. However that wasn't the problem. I must
have stuck it in there incorrectly while troubleshooting (I've been
pulling my hair out :))

Thank you,
Joseph Glass
Michigan State University

Ralph Mitchell wrote:

> OK, this is probably a silly question, but did you really mean what
> you put in your $postfields variable?? I mean, it kinda looks like
> you dropped a '&' right in the middle there, but if that's how it
> really oughta be, then OK...
>
> ...&submit=1divfel=F&...
>
>
> Ralph Mitchell
>
>
> Joseph E. Glass wrote:
>
>> Hi fellow Curl users,
>>
>> I'm having trouble getting a particular post to work. The page that I
>> am posting to by default has very general search results, so I'm trying
>> to modify the search criteria. The problem is, instead of bringing me
>> to a new search results page, it just brings me to general default page.
>> I've gotten posts to work on the same server before, so this is very
>> confusing.
>>
>> Below is the specific code I am using for this page. I'm using a cookie
>> that was previously set, I'm sending MS IE 6 as my agent, and I'm
>> setting the correct referrer. Also, see below for the header contents
>> and the output of formfield.pl on this page. Any help is appreciated.
>> Thank you!
>> Joseph Glass
>> Michigan State University
>>
>> $referer = "http://www5.apa.org/membership/";
>> $url = "http://www5.apa.org/membership/divroster.cfm";
>> $postfields = "divnum=12&submit=1divfel=F&divmem=M&divassoc=";
>>
>> $ch = curl_init();
>> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Save to variable
>> curl_setopt($ch, CURLOPT_REFERER, $referrer);
>> curl_setopt($ch, CURLOPT_HEADER, 1); // Get the header?
>> curl_setopt($ch, CURLOPT_USERAGENT, $agent);
>> curl_setopt($ch, CURLOPT_URL, "$url");
>> curl_setopt($ch, CURLOPT_COOKIEJAR, "$cookie_jar"); // Save for later
>> curl_setopt($ch, CURLOPT_COOKIEFILE, "$cookie_jar"); // Now use the
>> cookie
>> curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // Allow redirection?
>> curl_setopt($ch, CURLOPT_POST, 1);
>> curl_setopt($ch, CURLOPT_POSTFIELDS, "$postfields");
>> $tmp3 = curl_exec($ch);
>> curl_close($ch);
>> unset($ch);
>>
>> -------------------------------------
>> HTTP/1.1 100 Continue Server: Microsoft-IIS/5.0 Date: Mon, 07 Jul 2003
>> 01:57:15 GMT HTTP/1.1 200 OK Server: Microsoft-IIS/5.0 Date: Mon, 07 Jul
>> 2003 01:57:15 GMT Connection: close Content-type: text/html
>> Page-Completion-Status: Normal Page-Completion-Status: Normal
>> Set-Cookie: CFID=2048518; path=/; Set-Cookie:
>> --------------------------------------
>>
>> --- FORM report. Uses POST to URL "http://search2.apa.org/results.cfm"
>> --- end of FORM
>> --- FORM report. Uses POST to URL "division.cfm"
>> Select: NAME="divnum"
>> Option VALUE="01"
>> Option VALUE="02"
>> Option VALUE="03"
>> Option VALUE="05"
>> Option VALUE="06"
>> Option VALUE="07"
>> Option VALUE="08"
>> Option VALUE="09"
>> Option VALUE="10"
>> Option VALUE="12"
>> Option VALUE="13"
>> Option VALUE="14"
>> Option VALUE="15"
>> Option VALUE="16"
>> Option VALUE="17"
>> Option VALUE="18"
>> Option VALUE="19"
>> Option VALUE="20"
>> Option VALUE="21"
>> Option VALUE="22"
>> Option VALUE="23"
>> Option VALUE="24"
>> Option VALUE="25"
>> Option VALUE="26"
>> Option VALUE="27"
>> Option VALUE="28"
>> Option VALUE="29"
>> Option VALUE="30"
>> Option VALUE="31"
>> Option VALUE="32"
>> Option VALUE="33"
>> Option VALUE="34"
>> Option VALUE="35"
>> Option VALUE="36"
>> Option VALUE="37"
>> Option VALUE="38"
>> Option VALUE="39"
>> Option VALUE="40"
>> Option VALUE="41"
>> Option VALUE="42"
>> Option VALUE="43"
>> Option VALUE="44"
>> Option VALUE="45"
>> Option VALUE="46"
>> Option VALUE="47"
>> Option VALUE="48"
>> Option VALUE="49"
>> Option VALUE="50"
>> Option VALUE="51"
>> Option VALUE="52"
>> Option VALUE="53"
>> Option VALUE="54"
>> Option VALUE="55"
>> [end of select]
>> Input: NAME="submit" (IMAGE)
>> Input: NAME="divfel" VALUE="F" (CHECKBOX)
>> Input: NAME="divmem" VALUE="M" (CHECKBOX)
>> Input: NAME="divassoc" VALUE="A" (CHECKBOX)
>> --- end of FORM
>>
>>
>>
>> -------------------------------------------------------
>> This SF.Net email sponsored by: Parasoft
>> Error proof Web apps, automate testing & more.
>> Download & eval WebKing and get a free book.
>> www.parasoft.com/bulletproofapps
>>
>>
>
>
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by: Parasoft
> Error proof Web apps, automate testing & more.
> Download & eval WebKing and get a free book.
> www.parasoft.com/bulletproofapps

-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps
Received on 2003-07-10