0

Possible Duplicate:
PHP Simple HTML DOM Parser: Accessing custom attributes

I'm searching for a way to import data from html tags to sql. The webpage is on an external server.

I have a website with this string;

<div class="item_1" value_1="1a" value_2="1b" value_3="1c">
  some text which i don't want to import into sql
</div>

<div class="item_2" value_1="2a" value_2="2b" value_3="2c">
  some text which i don't want to import into sql
</div>

I would like to store the class and value_1, value_2 and value_3 attributes to a mySQL database using a php script file.

I have set up a cURL script to export the data to a text file but this includes all text and not just the attributes that I need. And I was only able to echo the results as HTML.

Can someone please enlighting me on how to do this. If it is even possible....

1
  • And this is not data mining. This barely is web scraping. Commented Dec 29, 2012 at 23:27

1 Answer 1

1

You can use an HTML parser like this one: http://simplehtmldom.sourceforge.net/

Or you can just parse through it like text (simple or w. RegEx)

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

2 Comments

Parsing HTML with regular expressions is a bad idea. htmlparsing.com/regexes.html
@AndyLester - I agree and that link is helpful - it still remains an option though and I think HTML parsers are the ideal solution.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.