Req #51551 [Com]: Include custom HTTP headers in request

From: Date: Fri, 23 Jul 2010 14:35:20 +0000
Subject: Req #51551 [Com]: Include custom HTTP headers in request
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-152682@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=51551&edit=1

 ID:               51551
 Comment by:       vikular at gmail dot com
 Reported by:      ed at atl dot org
 Summary:          Include custom HTTP headers in request
 Status:           Closed
 Type:             Feature/Change Request
 Package:          SOAP related
 Operating System: ALL
 PHP Version:      5.3SVN-2010-04-13 (SVN)
 Assigned To:      srinatar

 New Comment:

I've seen the use stream contexts answer so many times and it has never
worked for me. I am creating the stream just as specified, with the only
options being the http=>header=>"myheader: value\r\n"

I did notice that some people get it to work. So my question is, when
you specify it and it doesn't come through in HTTP headers, why doesn't
it ? Why no errors complaining about whatever was wrong with the header
string?

I've gone over php_http.c -- I can't tell why but the block at line 695
doesn't seem to be being executed for me, running PHP 5.3.2.


Previous Comments:
------------------------------------------------------------------------
[2010-07-23 07:59:41] dmitry@php.net

You can already send HTTP headers through stream context.

<?php
$opts = array(
  'http'=>array(
    'header'=>"New: test header\r\n"
  )
);

$context = stream_context_create($opts);

$client = new SoapClient(NULL, array(
    	      'stream_context' => $ctx,
    	      'location' => 'test://',
    	      'uri' => 'test://'));

------------------------------------------------------------------------
[2010-06-23 20:28:22] srinatar@php.net

I agree, it is very useful. I will look more into this patch. thanks for
the 
suggested patch

------------------------------------------------------------------------
[2010-04-13 18:46:30] ed at atl dot org

Description:
------------
When creating a soap client, I would also like to be able to identify
custom HTTP headers.

See attached patch, please include in next release (which will also
require the documentation to be included)

Test script:
---------------
$client = new
SoapClient('http://london:8180/testing/headerserver.php?wsdl',
    array(
        "trace"=>true,
        "custom_http_header"=>"New: test header"
    ));



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51551&edit=1


Thread (4 messages)

« previous php.bugs (#152682) next »