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

curl-and-php

Re: Submitting form with strange __multiselect parameters

From: Waruna Geekiyanage <waruna.ns_at_gmail.com>
Date: Wed, 07 Aug 2013 15:14:37 +0530

submit your PHP/cURL code, so that we can give a clear answer.

Use following settings to submit POST data
             curl_setopt ($ch, CURLOPT_POST, 1);
             curl_setopt ($ch, CURLOPT_POSTFIELDS, $arr_postdata);

$arr_postdata - field name as key and field data as value

use following setting for debugging

curl_setopt($ch, CURLINFO_HEADER_OUT, 1);
$info = curl_getinfo($ch, CURLINFO_HEADER_OUT);

$info will give the request headers.

Thank You,
Waruna Geekiyanage

M: +94 71 4168164
E: waruna.ns_at_gmail.com <mailto:warunans_at_gmail.com>
MSN: warunans_at_hotmail.com
GTalk: waruna.ns
ICQ: 225184383
Yahoo: warunans
Skype: warunans

On 8/7/2013 2:32 PM, Oscar Vidal wrote:
>
> Hi!
>
> I'm trying to submit a (java servlet) form using CURL in PHP, but it
> seems like there is a problem with the parameters. I cant really
> understand why its happening since I'm testing the CURL with a
> identical string parameters that is being used by the browser.
>
> After some research in diverse forums I wasn't able to find a solution
> to my particular problem.
>
> this is the POSTFIELDS string generated by the browser (and working):
>
> |submissionType=pd&__multiselect_PostCodeList=&selectedPostCode=01&selectedPostCode=02&selectedPostCode=03&__multiselect_selectedPostCodes=
> |
>
> and I'm using and identical (for testing) string in the PHP script but
> it im getting a HTML file as a answers telling "Missing parameters in
> search query".
>
> I believe that the form
>
> |__multiselect_PostCodeList=
> &selectedPostCode=01
> &selectedPostCode=02
> &selectedPostCode=03
> &__multiselect_selectedPostCodes=
> |
>
> is quite wired (never see before this) and I'm wondering that it can
> be the reason of why the post is not working from CURL.
>
> The form seems to be successfully submitted since I'm getting this header
>
> |HTTP/1.1 200 OK
> Date: Wed, 07 Aug 2013 08:02:56 GMT
> Content-length: 1791
> Content-type: text/html;charset=UTF-8
> X-Powered-By: Servlet/2.4 JSP/2.0
> Vary: Accept-Encoding
> Content-Encoding: gzip
> Connection: Keep-Alive
> |
>
> Note: I tried submitting the same form from /Lynx/ and I'm also
> getting the same result ("Missing parameters in search query"). So it
> seems like its only working with browsers like Mozilla or Chrome.
>
> Please some help will be really appreciated, I don't have any more
> ideas at this point.
>
> Thanks! Oscar
>
>
>
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2013-08-07