Sign in to follow this  
Followers 0
longphant

Script to check prices of airfare

6 posts in this topic

Hi,

I'd like to make a script to check prices of airfare. Let's say I'm on priceline and I have a list of prices for a flight from the US to Japan. I want to make a list of the flight number, the flight duration, departure time, and the price. Then I want to refresh the page every so often (let's say every 24 hours for example), and then make another list of the prices. I then want my script to email me whenever the prices change for a particular flight.

How would I make this list? I know that after getting the list, I can just diff the two.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi, longphant, welcome to the forum. I would suggest starting with a thorough read of the help file, especially the _IE functions (go through all of the examples). This will show you how to open a web page and begin manipulating the data.

Once you have some code (even if it is not working as you'd like it to), post it here and we will do what we can to assist :)

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

May I suggest something to you longphant.

My wife and I did some heavy research in ticket prices for a 6 month period of time. I would suggest forcing an update every 5-10 minutes, as we have seen prices hop within a 10 minute interval before.

The way airline ticketing systems work is that if it sees a flight with a lot of seat still available compared to other similar flights, the prices will drop until it reaches a certain threshold. Then prices will go back up. Once occupancy begins to increase and gets within the range they want it to be within a certain period of time, they set the rates back up to their 'normal' rate (or even over-inflated... but that's just speculation.)

However, for flights that are popular (your Fridays and Sundays) you will hardly ever see a fluctuation in price changes.

Edited by mechaflash213

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites

Here is some code I came up with.

I am using an example from

$url = "http://travela.priceline.com/airlines/fareResults.do?session_key=5064010A5564010A20120904210113339ae0292933&plf=pcln&jarmkey=5764010A5663010AZxCNFLiu1EyNVlrFMHyl9A3835&INIT_SESSION=true"
$oIE = _IECreate ($url)
_IELoadWait ($oIE)

I then see the example use:

$uForm = _IEFormGetObjByName ($oIE, "gaia_loginform")   ;<<< Change to form html name on webpage
$uText = _IEFormElementGetObjByName ($uForm, "Email")   ;<<< Change to input name of username field box within form on webpage
_IEFormElementSetValue ($uText,$user)
$pText = _IEFormElementGetObjByName ($uForm, "Passwd")  ;<<<Change to input name of password field box within form on webpage
_IEFormElementSetValue ($pText,$pass)
_IEFormSubmit ($uForm)

I assume that I now begin grabbing form elements on the page. I did an inspect on the areas that show the price and they are all called td.choose_price. Can you assist me a little bit here on how I would manipulate one listing so that I can grab information from it?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Hi, longphant. I would caution that you are treading into murky waters when discussing auto logins for the site. Please ensure you've read the forum rules. It doesn't look like you're doing this, but your example may throw some red flags :)

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0