0

I want to make a getrequest to www.seatguru.com, which for instance would look like this: http://www.seatguru.com/findseatmap/findseatmap.php?airlinetext=American+Airlines&carrier=AA&flightno=3180&from=Philadelphia%2C+PA+-+Philadelphia+International+Airport+%28PHL%29&to=&date=07%2F03%2F2013&from_loc=PHL&to_loc=&search_type=

The problem is that when I get the request back, it only shows the 'Loading...', which means that I can check the output. Is there any way I can get around that?

Here's my curl:

$qry_str = "?airlinetext=American+Airlines&carrier=AA&flightno=3180&from=Philadelphia%2C+PA+-+Philadelphia+International+Airport+%28PHL%29&to=&date=07%2F03%2F2013&from_loc=PHL&to_loc=&search_type=";
$ch = curl_init();

// Set query data here with the URL
curl_setopt($ch, CURLOPT_URL, 'http://www.seatguru.com/findseatmap/findseatmap.php' . $qry_str); 

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, '3');
$content = trim(curl_exec($ch));
curl_close($ch);

Thanks alot.

3
  • dont scrape sites that ask you not to. Commented Jun 29, 2013 at 22:49
  • Oh I didn't realise it asked me not to. My bad. Commented Jun 29, 2013 at 22:49
  • not surprising really, spend millions of dollars on your site, you don't want other's to steal from you. Commented Jun 29, 2013 at 22:53

1 Answer 1

2

This is happening because the results are actually loaded via ajax. So when the page is loaded, the results aren't there and you see the loading sign. You can get around this by querying the url that the page uses to get the results. Ideally, you would search through document inspector(Chrome/FF Firebug) for XHR requests and sort through them for the relevant one, but hey I did the work for you.

http://www.seatguru.com/ajax/findseatmap.php?from=PHL&to=&flightno=3180&carrier=AA&date=07%2F03%2F2013

(Note the ajax in the url before findseatmap)

Oh and do ask them before you scrape. Its generally bad to scrape since they lose business.

Sign up to request clarification or add additional context in comments.

6 Comments

want to help him rob a bank to?
Its still a valid question. You can't really expect to keep people from robbing banks by not telling them how the lock turns.
i agree you cant, but still think its worth trying.
but there'll always be another guy around. One who won't postscript it with an ethical warning. Okay maybe giving the link was overkill
@dagon is that not a bit over the top, robbing a bank != scraping a site. And we are not the ethics police! seatguru should improve their security if they are really opposed to this, and who says the asker will not add a link to their site and actually increase their visits... +1 for the right answer.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.