Jump to content

file_get_contents


boon

Recommended Posts

I am looking to write a script to bring up hotel rates fast. My question is when I have the url which will bring up rates and use file_get_contents it does not bring up the correct information that I need but if I load that exact url I used in file_get_contents right up into the browser or even load it in an iframe it works flawlessly.

 

http://www.ichotelsgroup.com/h/d/hi/1/en/rates/mspmd?ias=y&countryRequired=yes&newSearch=yes&packageRatesFlag=&countryId=0001&hotelCode=mspmd&errorURL=%2Fh%2Fd%2Fhi%2F1%2Fen%2Fadvancedsearch%3FquickRes%3Dcity&successURL=%2Fh%2Fd%2Fhi%2F1%2Fen%2Fhotelsearchresults&advancedSearchForwardURL=%2Fh%2Fd%2Fhi%2F1%2Fen%2Fasearch&brandGroupCode=hi&currentBrandId=HI&actionName=advancedSearch&requiresCheckinDate=true&availabilitySearchSuccessURL=%2Fh%2Fd%2Fhi%2F1%2Fen%2Frates%2Fmspmd%3Fias%3Dy%26errorURL%3D%2Fh%2Fd%2Fhi%2F1%2Fen%2Fadvancedsearch&clarifyDestinationURL=%2Fh%2Fd%2Fhi%2F1%2Fen%2Fhotelsearchclarify&searchGroupCodes=HI&searchGroupCodes=EX&searchGroupCodes=RS&searchGroupCodes=SL&searchGroupCodes=SS&searchGroupCodes=FS&rateGroupCode=hi&fromAdvancedSearch=true&datePattern=MM%2Fdd%2Fyyyy&checkInFullDate=02/25/2008&number_Nights=2&checkOutFullDate=02/26/2008&numberOfAdults=1&numberOfChildren=0&numberOfRooms=1&roomTypePreference=3&smokingPreference=3&rateTypeCodes=6CBARC&corporateNumber=&groupBookingCode=&iata=&brands=SS&brands=CP&brands=FS&brands=IN&brands=EX&brands=HI&brands=SL&findHotels.x=0&findHotels.y=0

 

That is the url I am using and if you copy/paste that in the browser it works fine. Using file_get_contents loads another page all together. Any reason for this or a way around it? Thanks for your help!

Link to comment
https://forums.phpfreaks.com/topic/92232-file_get_contents/
Share on other sites

I am looking to write a script to bring up hotel rates fast. My question is when I have the url which will bring up rates and use file_get_contents it does not bring up the correct information that I need but if I load that exact url I used in file_get_contents right up into the browser or even load it in an iframe it works flawlessly.

 

http://www.ichotelsgroup.com/h/d/hi/1/en/rates/mspmd?ias=y&countryRequired=yes&newSearch=yes&packageRatesFlag=&countryId=0001&hotelCode=mspmd&errorURL=%2Fh%2Fd%2Fhi%2F1%2Fen%2Fadvancedsearch%3FquickRes%3Dcity&successURL=%2Fh%2Fd%2Fhi%2F1%2Fen%2Fhotelsearchresults&advancedSearchForwardURL=%2Fh%2Fd%2Fhi%2F1%2Fen%2Fasearch&brandGroupCode=hi&currentBrandId=HI&actionName=advancedSearch&requiresCheckinDate=true&availabilitySearchSuccessURL=%2Fh%2Fd%2Fhi%2F1%2Fen%2Frates%2Fmspmd%3Fias%3Dy%26errorURL%3D%2Fh%2Fd%2Fhi%2F1%2Fen%2Fadvancedsearch&clarifyDestinationURL=%2Fh%2Fd%2Fhi%2F1%2Fen%2Fhotelsearchclarify&searchGroupCodes=HI&searchGroupCodes=EX&searchGroupCodes=RS&searchGroupCodes=SL&searchGroupCodes=SS&searchGroupCodes=FS&rateGroupCode=hi&fromAdvancedSearch=true&datePattern=MM%2Fdd%2Fyyyy&checkInFullDate=02/25/2008&number_Nights=2&checkOutFullDate=02/26/2008&numberOfAdults=1&numberOfChildren=0&numberOfRooms=1&roomTypePreference=3&smokingPreference=3&rateTypeCodes=6CBARC&corporateNumber=&groupBookingCode=&iata=&brands=SS&brands=CP&brands=FS&brands=IN&brands=EX&brands=HI&brands=SL&findHotels.x=0&findHotels.y=0

 

That is the url I am using and if you copy/paste that in the browser it works fine. Using file_get_contents loads another page all together. Any reason for this or a way around it? Thanks for your help!

 

what is your allow_url_fopen setting in your php.ini??

Link to comment
https://forums.phpfreaks.com/topic/92232-file_get_contents/#findComment-472487
Share on other sites

So I used curl as well still get the same thing. The page will load the rates perfect if i type out the address in the url but if i use curl or fopen or even file_get_contents it doesn't load the same site even. It loads the search page again.

 

 

Take a look at this example. It shows the URL, Iframe and then using Curl and the pages it displays.

 

 

http://brian.nerdjock.com/

Link to comment
https://forums.phpfreaks.com/topic/92232-file_get_contents/#findComment-472493
Share on other sites

what is your allow_url_fopen setting in your php.ini??

 

allow_url_fopen = On

allow_url_include = On

 

 

Now you may have to click find hotel/check availability on the bottom right of the iframe the first time to set a the cookie for the site but after that it should load the rates page just fine for the dates im looking for in the iframe. when I use curl on the bottom to put the exact same address in a string it returns a totally different page. Any suggestions would be greatly appreciated!

Link to comment
https://forums.phpfreaks.com/topic/92232-file_get_contents/#findComment-472915
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.