Page 1 of 1

[SOLVED] Help reading data from another page!

Posted: Sun Jan 04, 2004 1:12 pm
by TristanOfADown
What I need to do is get raw data off of a page on another server and into a mysql db on my server. I know a little about php, and have been trying for the past couple hours, but to no avail, so I decided to go look for help. The page that the data is on is: http://www.d2jsp.org/gold_giveaway2.php

Thanks in advance.

Posted: Sun Jan 04, 2004 2:09 pm
by JAM
Try this on a page and see what that gives you as for clues.

Code: Select all

<pre>
<?php
    $site = 'http://www.d2jsp.org/gold_giveaway2.php';
    $results = file($site);
    foreach($results as $line) {
        $arr = explode(',',$line);
        // To show you what it looks like now...
        print_r($arr);
        // Add database inserts here etc. etc.
    }
?>
If you are inserting that into a database, the explode() part can be excluded, and use $line instead after abit tweaking around.

Posted: Sun Jan 04, 2004 2:20 pm
by TristanOfADown
Ah, that works perfectly! Thank yoou very much!