boon Posted February 21, 2008 Share Posted February 21, 2008 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¤tBrandId=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 More sharing options...
vbnullchar Posted February 21, 2008 Share Posted February 21, 2008 http://www.phpit.net/article/using-curl-php/ Link to comment https://forums.phpfreaks.com/topic/92232-file_get_contents/#findComment-472485 Share on other sites More sharing options...
priti Posted February 21, 2008 Share Posted February 21, 2008 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¤tBrandId=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 More sharing options...
boon Posted February 21, 2008 Author Share Posted February 21, 2008 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 More sharing options...
boon Posted February 21, 2008 Author Share Posted February 21, 2008 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 More sharing options...
Daniel0 Posted February 21, 2008 Share Posted February 21, 2008 Perhaps you should reconsider how you make your URLs... Note: Has nothing to do with the problem. Link to comment https://forums.phpfreaks.com/topic/92232-file_get_contents/#findComment-472980 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.