XCS
XCS

Reputation: 28177

Get values from php page

I've made a database,and for each row I've created a new php page and saved some values in the DB table.

Now, I want to insert the values from the PHP page that I've forgot to insert in the DB.

I only have 3 values. I know for each row the PHP page (url) from where I need to grab the values.

The values show up in the php page like this

   <table>
        <tr>
            <td>
            Column1
            </td>
            <td>
            Value-c1
            </td>
        </tr>

        <tr>
            <td>
            Column2
            </td>
            <td>
            Value-c2
            </td>
        </tr>

        <tr>
            <td>
            Column3
            </td>
            <td>
            Value-c3
            </td>
        </tr>

</table>

The page containg this table has other content too. I just need to take Value-c1 and insert it into Column1 in the MySQL table.

How can I get the content of the PHP page (having the URL) and also get the specific values that I want.

EDIT:

I have multiple static PHP pages (like 100) and I want to make a PHP script that will go through all the pages (I know their urls) and get from each page the values from the table and insert them into a DB.

Is that clear now? :D

Upvotes: 0

Views: 140

Answers (2)

Johann du Toit
Johann du Toit

Reputation: 2667

The Easiest would probaly be to use Regex to get all the tr blocks from the page. You can then loop all the rows and run another Regex pattern to get the Column1 and the Value value.

Upvotes: 0

Quamis
Quamis

Reputation: 11087

What you need is called sreen (or web) scraping. See http://en.wikipedia.org/wiki/Web_scraping for details.

Take a look at

for more answers

Upvotes: 1

Related Questions