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

curl-and-php

curl redirect

From: Felix Schubert <mailing_at_unity-concepts.de>
Date: Tue, 8 Jul 2003 23:50:36 +0200

Hello everybody,

for a curl experienced user I think this question is not hard to answer.

Scenario:

I got a script which generates a preview from a form. After hitting the
submit button the preview data is written to a database (This part
works) and a POST must be transferred to a foreign server (therefore I
use curl) and the user should be displayed the URL the POST is
transferred to.

How do I get a redirect to the foreign server?

Sniplet:
                $url = $_SESSION['hook_url'];
                $c = curl_init();
                curl_setopt($c, CURLOPT_URL, $url);
                curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1);
                curl_setopt($c, CURLOPT_POST, 1);
                curl_setopt($c, CURLOPT_POSTFIELDS, $_POST);
                $page = curl_exec($c);
                curl_close($c);

Thanks by a curl newbie near nervous breakdown

Felix

-------------------------------------------------------
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-09