note 44997 deleted from ref.curl by tomsommer

From: Date: Sun, 22 Aug 2004 21:55:39 +0000
Subject: note 44997 deleted from ref.curl by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-75133@lists.php.net to get a copy of this message
Note Submitter: Dan Poltawski ---- 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 :)

« previous php.notes (#75133) next »