Hi,

Do anyone know that how curl doing POST in second request? Means at the first request curl using redirect but for the second request is POST method.

Appreciate for you help.

Thanks

Lik Chin

    curl_setopt ($ch, CURLOPT_POST, 1);
    curl_setopt ($ch, CURLOPT_POSTFIELDS, "a_=_a&b_=_b");

      curl_setopt ($ch, CURLOPT_POST, 1);
      curl_setopt ($ch, CURLOPT_POSTFIELDS, "a=a&b=b");

      the code above is doing for first request. how about the second request? For example,

      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL, 'http://www.abc.com');
      curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
      $res = curl_exec($ch);
      curl_close($ch);

      the www.abc.com will POST (not redirect) to another server call www.def.com. and then www.def.com will back to ww.abc.com and come back to my application.

      My problem now is the curl never return back to my application. I think some connection loss in between.

      Please help....

      Thanks.

        Initialize a new curl session for that ...

          how to initialize a new curl session? because the www.abc.com post directly to www. def.com already.

            I'm not sure that u can POST ----> POST OR GET ----> GET with only one session, u can follow link in case of some redirects ...

              Is there any special option for me to allow POST in the middle of redirection?

                I dont think there is, u should rethink your script, anyway u can create another thread with your last question ...

                  Write a Reply...