How to fix 411 Length Required error with file_get_contents and the expedia XML API? [closed]

By | July 12, 2018

I am doing the online hotel booking using xml api(php) project.When i am working in the reservation code it shows error of the following

"Warning: file_get_contents(</email><firstName>test</firstName><lastName>smith</lastName><homePhone>8870606867</homePhone><creditCardType>CA</creditCardType><creditCardNumber>5401999999999999</creditCardNumber>....</HotelRoomReservationRequest>) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.0 411 Length Required"

its my code

$context  = stream_context_create(
                    'http' => array(
                        'method' => 'POST',
                        'header' => "Content-type: application/x-www-form-urlencoded",
                        "Accept: application/xml"
$url ='';
$xml = file_get_contents($url, false, $context);

It’s for sending credit information plz kindly give me suggestion what type of error… .


Leave a Reply

Your email address will not be published. Required fields are marked *