ローカル環境:PHP Version 5.5.15
レンタルサーバ:PHP Version 5.3.3
レンタルサーバでfile_get_contentsを実行すると、
ステータスは正常なのですが、結果が途中で切れてしまいます。
ローカル環境で同じファイルを読み込むと全て読み込めます。
.htaccessでmemory_limit、post_max_sizeを
ローカル環境の値にあわせてみましたがダメでした。
stream_get_contentsに処理を変えてもダメでした。
結果のサイズを調べると毎回変わります。
少ない情報で申し訳御座いませんが、
ヒントをお持ちの方よろしくお願いします。
とあるAPIです。
<?php $url = 'http://openapi.ctrip.com/Hotel/OTA_HotelRatePlan.asmx'; $xml = '<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><Request xmlns="http://ctrip.com/"><requestXML><Request><Header AllianceID="13790" SID="447679" TimeStamp="1423685768" Signature="A86E83DA8BD13EA78A8ECF33FF0A42FA" RequestType="OTA_HotelRatePlan" AsyncRequest="false" Timeout="0" MessagePriority="3" />
<HotelRequest>
<RequestBody xmlns:ns="http://www.opentravel.org/OTA/2003/05" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ns:OTA_HotelRatePlanRQ TimeStamp="2012-05-01T00:00:00.000+08:00" Version="1.0">
<ns:RatePlans>
<ns:RatePlan>
<ns:DateRange Start="2016-04-13" End="2016-04-20"/>
<ns:RatePlanCandidates>
<ns:RatePlanCandidate AvailRatesOnlyInd="true" >
<ns:HotelRefs>
<ns:HotelRef HotelCode="345001"/>
</ns:HotelRefs>
</ns:RatePlanCandidate>
</ns:RatePlanCandidates>
</ns:RatePlan>
</ns:RatePlans>
</ns:OTA_HotelRatePlanRQ>
</RequestBody>
</HotelRequest>
</Request></requestXML></Request></soap:Body></soap:Envelope>';
$cnt = stream_context_create( array( 'http' => array( 'method' => "POST", 'header' => "Content-Type: text/xml; charset=utf-8;", 'content' => $xml ) ) ); $res = file_get_contents($url, false, $cnt); var_dump($res);
?>