Calling HttpRequest::getRawRequestMessage() without send()
        Posted  
        
            by 
                danielgrad
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by danielgrad
        
        
        
        Published on 2013-07-02T23:00:22Z
        Indexed on 
            2013/07/02
            23:05 UTC
        
        
        Read the original article
        Hit count: 261
        
php
|httprequest
I am trying to call getRawRequestMessage() to get the raw HTTP content of the request described by a HttpRequest object, but I notice it always returns an empty string if I don't call send() first. Which kind of defeats my purpose (I want to send the data through other means than the HttpRequest's own send() method). Is there any other way to convert a HttpRequest object to it's raw string equivalent?
To give more context: I'm working with a complex class that builds a HttpRequest object and sends requests through it and I want to add a new mode to the class that will work through raw sockets instead. The request is already built in the HttpRequest object and I would like to not have to parse the object manually to generate the HTTP message.
© Stack Overflow or respective owner