Jump to content

datafeed


chery

Recommended Posts

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]CSV Feed Live
You may retrieve the latest copy of the CSV feed at any time using the link below. This allows you to quickly save the feed from your browser or set up an automated import system to keep your database up-to-date automatically.[/quote]

How do I make an automated import sytem - one that will delete all entries and replace them with the new ones - and get it to update once per day perhaps?

I would appreciate any help as this one has me absolutely stumped.





Link to comment
Share on other sites

You can parse a CSV file as easily as something like this:
[code]<?php
$contents = file("http://www.thewebsite.com/file.csv");
foreach($contents as $line) {
    $line = explode(",",$line);
    //$line is now an array of all of the fields in the current line in the csv.
}
?>[/code]
That code should point you in the right direction, might be worth checking out file functions in the php manual too.

As for running once a day, you'd need to set up a cron job (if using *NIX) or an entry in Scheduler (if using Win).
Link to comment
Share on other sites

[!--quoteo(post=376987:date=May 25 2006, 08:03 AM:name=SemiApocalyptic)--][div class=\'quotetop\']QUOTE(SemiApocalyptic @ May 25 2006, 08:03 AM) [snapback]376987[/snapback][/div][div class=\'quotemain\'][!--quotec--]
You can parse a CSV file as easily as something like this:
[code]<?php
$contents = file("http://www.thewebsite.com/file.csv");
foreach($contents as $line) {
    $line = explode(",",$line);
    //$line is now an array of all of the fields in the current line in the csv.
}
?>[/code]
That code should point you in the right direction, might be worth checking out file functions in the php manual too.

As for running once a day, you'd need to set up a cron job (if using *NIX) or an entry in Scheduler (if using Win).
[/quote]

Does this look right?
[code]<?php
include("db.php");
mysql_connect($db_host, $db_user, $db_pwd);
mysql_select_db($db_name);

$contents = file("http://dc1datafeed.regnow.com/srv/rs.aspx?&afid=54516");
foreach($contents as $line) {
    $line = explode(",",$line);
    //$line is now an array of all of the fields in the current line in the csv.
}
?>[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.