[SOLVED] Help reading data from another page!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
TristanOfADown
Forum Newbie
Posts: 2
Joined: Sun Jan 04, 2004 1:12 pm
Location: 127.0.0.1

[SOLVED] Help reading data from another page!

Post 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.
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post 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.
TristanOfADown
Forum Newbie
Posts: 2
Joined: Sun Jan 04, 2004 1:12 pm
Location: 127.0.0.1

Post by TristanOfADown »

Ah, that works perfectly! Thank yoou very much!
Post Reply