Re: Syntax for CURL

From: Date: Mon, 21 May 2001 16:33:29 +0000
Subject: Re: Syntax for CURL
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-53753@lists.php.net to get a copy of this message
The script below is working fine for me: $data2send = "field1=value1&field2=value2"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"https://www.postside.com/postpage"); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_REFERER, "https://www.yoursite.com/"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data2send); $result=curl_exec ($ch); curl_close ($ch); You can find meanings of options at: http://www.php.net/manual/en/function.curl-setopt.php Some guidelines for options: USERAGENT is sometimes necessary on some sites as they do not let you connect if your browser is not known. FOLLOWLOCATION is necessary for following redirects on posting page. You can find others easily. Yours, -- Tolga 'thorr' Orhon "Todd Cary" <todd@aristesoftware.com> wrote in message news:3B09337B.3010C484@aristesoftware.com... > I need to send a POST string to a HTTPS server and receive the returned > string. Does anyone know the correct syntax for this? I have looked at > the HELP a www.php.net; however, I am not completely clear on what I > need to put into the curl_setopt(). > > Todd > > -- > Todd Cary > Ariste Software > todd@aristesoftware.com > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#53753) next »