There's a site that sells tickets to shows. I'm hoping to write a script that can tell someone when tickets go on sale so they can beat the scalpers.
Here's a link to a show.
When you click the 'find tickets' button on that page, you get a popup to a URL like this:
https://www.somedomain.com/folder/bar.aspx?prodID=6075
It's obvious the prodID arg from the original page is propagated to the url of the popup. HOWEVER the HTML and scripts in that popup don't propagate the prodID to any form inputs or cookies as far as I can tell. When you submit it (and action="get"), the popup window navigates to a URL like this:
https://www.somedomain.com/folder/anotherScript.aspx?tickets=2&seatType=0&safran=0.42006457285684196
The safran value is just a random number created by this Javascript function which is triggered when the form is submitted:
function submitForm(){
linkTo('dateTime.aspx?tickets='+document.form.tickets.value+'&seatType='+document.form.seatType.value);
}
the link to function is defined in this code:
releaseTickets=true;
function linkTo(where) {
var strRand;
var strAltWhere;
okToUnload();
strAltWhere = where;
strRand = Math.random();
if (strAltWhere.indexOf('?') > -1) {
strAltWhere = strAltWhere + '&safran=' + strRand;
}
else {
strAltWhere = strAltWhere + '?safran=' + strRand;
}
where = strAltWhere;
location.replace(where);
}
function okToUnload(){
releaseTickets=false;
}
function unloading(){
if(releaseTickets){
release();
}
}
function release(){
r=window.open('release.aspx','releasing','width=320,height=160,toolbar=0,menubar=0,status=0,scrollbar=0');
r.focus();
}
Question 1:
I'm guessing that the first popup ASPX page is storing the prodID in session and the second one is retrieving it. Does that sound reasonable?
Question 2:
I'm wondering what cURL-related cookie options I need to set in order to accept a session cookie from the remote server and cough it up when the remote server asks for it. These seem relevant, but I'm not sure what to set the first one to:
curl_setopt($curl, CURLOPT_COOKIESESSION, TRUE);
curl_setopt($curl, CURLOPT_COOKIEFILE, "cookiefile");
curl_setopt($curl, CURLOPT_COOKIEJAR, "cookiefile"); # SAME cookiefile
The docs say this about CULROPT_COOKIESESSION:
TRUE to mark this as a new cookie "session". It will force libcurl to ignore all cookies it is about to load that are "session cookies" from the previous session. By default, libcurl always stores and loads all cookies, independent if they are session cookies are not. Session cookies are cookies without expiry date and they are meant to be alive and existing for this "session" only.
What does it mean to ignore them? Does that mean I don't set them locally or I don't propagate them back? How does this relate to sessioning?