Jump to content

Extracting data from a table of another site


juz4eugene

Recommended Posts

I need help on extracting of data from another website, commonly known as screen scrapping. I was able to do it with a basic created function, but it doesn't work for extracting data out from a table of another website.

 

I want to extract the data from each row and data of this site http://online.wsj.com/mdc/public/page/2_3021-usetf.html, so that I can put these data into my database.

 

My current code is

 

<?php

$data = file_get_contents('http://online.wsj.com/mdc/public/page/2_3021-usetf.html');

$regex = '/You(.+?) registered/';

preg_match($regex,$data,$match);

var_dump($match);

echo $match[1];

?>

 

Anyone has a script that I could modify to do that? Thanks!

You've done...nothing here.  What do you know about regex?  You should be able to do this with relatively simple regular expressions.  There aren't really any pre-made scripts for screen scraping.

 

Also, it's probably illegal to scrape the Journal.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.