php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #51551 Include custom HTTP headers in request
Submitted: 2010-04-13 18:46 UTC Modified: 2010-07-23 07:59 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:2 (66.7%)
From: ed at atl dot org Assigned: srinatar (profile)
Status: Closed Package: SOAP related
PHP Version: 5.3SVN-2010-04-13 (SVN) OS: ALL
Private report: No CVE-ID: None
 [2010-04-13 18:46 UTC] 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"
    ));


Patches

add_custom_http_header.patch (last revision 2010-04-13 16:47 UTC by ed at atl dot org)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-23 20:28 UTC] srinatar@php.net
-Assigned To: +Assigned To: srinatar
 [2010-06-23 20:28 UTC] srinatar@php.net
I agree, it is very useful. I will look more into this patch. thanks for the 
suggested patch
 [2010-07-23 07:59 UTC] dmitry@php.net
-Status: Assigned +Status: Closed
 [2010-07-23 07:59 UTC] 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-07-23 16:35 UTC] vikular at gmail dot com
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 01 19:01:31 2024 UTC