note 44997 added to ref.curl

From: Date: Sun, 22 Aug 2004 21:53:22 +0000
Subject: note 44997 added to ref.curl
Groups: php.notes 
Request: Send a blank email to php-notes+get-75132@lists.php.net to get a copy of this message
I was tearing my hair out trying to alter the http Content-Type header. It turns out I wasn't being very good at reading the docs, but to demonstrate how to dot his: <?php $request = "my data"; $url = 'http://yoururl.com'; $opts = Array("Content-Type: text/plain"); // the header options are in an array $channel = curl_init(); curl_setopt($channel, CURLOPT_URL, $url); curl_setopt($channel, CURLOPT_RETURNTRANSFER, 1); curl_setopt($channel, CURLOPT_HTTPHEADER, $opts); curl_setopt($channel, CURLOPT_POSTFIELDS, $request); $buffer = curl_exec($channel); curl_close($channel); ?> Seems simple enough, but I didn't spot it :) ---- Manual Page -- http://www.php.net/manual/en/ref.curl.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+44997 Delete -- http://master.php.net/manage/user-notes.php?action=delete+44997&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+44997&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#75132) next »