note 89669 added to function.curl-setopt

From: Date: Wed, 18 Mar 2009 16:14:11 +0000
Subject: note 89669 added to function.curl-setopt
Groups: php.notes 
Request: Send a blank email to php-notes+get-152100@lists.php.net to get a copy of this message
I wanted to create a script that acted as a bridge between an external server and an internal server, wherein the internal server was not connected to the internet, but had information required by the users connecting to the external server. I hatched the idea to use curl to connect from the external server to the internal server (using request variables to send queries) and return everything (data and headers) returned by the file server. After being driven mad by segmentation faults and crashes because the curl_exec didn't like me having the CURLOPT_HEADERFUNCTION's function directly dumping the header: function Duplicate_Header($curl, $header) { header($header); return strlen($header); } ... I tried (on a whim) duplicating and trimming the header and passing the duplicate to the header function... function Duplicate_Header($curl, $header) { $duplicate = trim($header); header($duplicate); return strlen($header); } Which worked just fine. I don't know if this is just some quirk of PHP4 or my lack of understanding of how the curl and header function works. ---- Server IP: 66.207.199.35 Probable Submitter: 206.75.15.5 ---- Manual Page -- http://www.php.net/manual/en/function.curl-setopt.php Edit -- https://master.php.net/note/edit/89669 Del: integrated -- https://master.php.net/note/delete/89669/integrated Del: useless -- https://master.php.net/note/delete/89669/useless Del: bad code -- https://master.php.net/note/delete/89669/bad+code Del: spam -- https://master.php.net/note/delete/89669/spam Del: non-english -- https://master.php.net/note/delete/89669/non-english Del: in docs -- https://master.php.net/note/delete/89669/in+docs Del: other reasons-- https://master.php.net/note/delete/89669 Reject -- https://master.php.net/note/reject/89669 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#152100) next »