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

curl-and-php

Re: another "post with curl" question

From: Richard Lynch <ceo_at_l-i-e.com>
Date: Wed, 29 Aug 2007 17:32:06 -0500 (CDT)

On Tue, August 28, 2007 3:03 pm, Yiğit Güneli wrote:
> i am new to curl and using it with php to include a remote webpage
> that has
> a html form.
> are there any methods for some kind of redirecting variables to
> original
> form rather than the "curled" one?
>
> i wrote this but it doesn't work as i expect.

What did you expect?
What did you get?

> $ch = curl_init();
> curl_setopt($ch, CURLOPT_URL, $adres);
> if ($_POST){
> foreach ($_POST as $nedir => $degermi)
> $postedicem.=$nedir."=".$degermi."&";

You may want to use urlencode($degermi) -- or maybe you don't need
that for POST data.

For fun:
echo $postedicem, "<hr />\n";

> curl_setopt($ch, CURLOPT_POST, 1);
> curl_setopt ($ch, CURLOPT_POSTFIELDS, $postedicem);
> }
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
> curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
> $ahmet=curl_exec($ch);

echo $ahmet;

> curl_close($ch);
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>

-- 
Please vote for this great band:
http://acl.mp3.com/feature/soundandjury/?band=COMPANY-OF-THIEVES
Requires email confirmation.
One vote per day per email limit.
Obvious ballot-stuffing will be revoked.
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2007-08-30