jeffery_the_wind
jeffery_the_wind

Reputation: 18158

Extract data from an .aspx page

I am trying to read some data from this page: http://www.cefconnect.com/Pricing/DailyPricing.aspx using PHP. I just need to get the list of ticker symbols that display on this page. There are over 500 symbols which get updated every day. It is a real nice page. I can use my web browser and see that the data I need is nicely organized into the class called ticker in the HTML table. But, I can't seem to get this table to show up for me when I use file_get_contents() in PHP. The reason is ( I think ), if you notice, the list of data actually takes a few seconds to load, so it is not loaded at first when the page initially loads.

I have done things like this before extracting data from "normal" HTML web pages. I use this code which i was hoping would work.

$url = "http://www.cefconnect.com/Screener/FundScreener.aspx";
$page = file_get_contents($url);
echo $page;

When I do this, I get a lot of the code from the page, but the table which shows the data is missing. I don't have any experience with ASPX pages, so I was hoping someone could point me in the right direction, hopefully accessing this data using PHP! Thanks!

Upvotes: 0

Views: 5334

Answers (1)

djb
djb

Reputation: 185

The data appears to be loaded from another URL using Ajax. The data isn't included in the rendered HTML page from the server. You can find this URL using Chrome's developer tools etc.

I assume you have permission to use this site's data otherwise scraping their data is almost certainly an infringement of some kind.

Upvotes: 3

Related Questions