【发布时间】:2012-02-23 11:59:51
【问题描述】:
我正在使用 xml api(php) 项目进行在线酒店预订。当我在预订代码中工作时,它显示以下错误
"Warning: file_get_contents(https://...@gmail.com</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"
这是我的代码
$context = stream_context_create(
array(
'http' => array(
'method' => 'POST',
'header' => "Content-type: application/x-www-form-urlencoded",
"Accept: application/xml"
)
)
);
$url ='https://book.api.ean.com/....';
$xml = file_get_contents($url, false, $context);
用于发送信用信息,请给我建议什么类型的错误...。
【问题讨论】:
-
您设置流上下文选项的方式有误。
-
谢谢请纠正我的代码提前谢谢
-
stackoverflow 不允许发布代码。我已经提供了足够的代码