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
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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.