0

I'm building an iPhone app version of a website that sells tickets online. I'm trying to re-implement the checkout process on iOS without using a UIWebView, passing around some variables (# of tickets, date, etc...) and just doing the final HTTP request to handle payment.

The problem is that I don't know the structure of the request that makes the final purchase. What should I do to reverse engineer this?

More importantly, is there a better way to modify a web checkout process for the iPhone screen?

pietrorea
  • 841
  • 6
  • 14
  • It sounds like you don't have access to the ticket-selling website's code. Is that right? Does the ticket-selling site have an official API to allow 3rd party developers to do this? – dontangg Jun 13 '12 at 16:13
  • No, it's a small company so there's no public API. I don't have the website's code either, they outsourced the web development to someone else. – pietrorea Jun 13 '12 at 16:22

1 Answers1

1

Visit this ticket-selling website's website and go all the way to the final screen before the payment is actually made. Then, take a look at all of the inputs in the HTML that are there and send a request with that data. If jQuery is on their webpage, it is really easy. Open the developer tools, go to the console where you can type commands, and just type $('input, textarea') and it will show you a list of all of them.

For example, if the page has a form like this.

<form method="post" action="makepayment.php">
    <input name="numTickets" />
    <input name="date" />
</form>

Then, you'll need to POST the numTickets and date to the makepayment.php page.

This is the data that you need to send in the HTTP request. There is a nice library that you can read up on here: http://allseeing-i.com/ASIHTTPRequest/. It lets you do something like this:

NSURL *url = [NSURL URLWithString:@"https://ticketsellers.com/makepayment.php"];
ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:url] autorelease];
[request setPostValue:@"2" forKey:@"numTickets"];
[request setPostValue:@"12/31/2012" forKey:@"date"];
[request startSynchronous];
dontangg
  • 4,729
  • 1
  • 26
  • 38