Welcome Guest, Not a member yet? Register   Sign In
CI & Rsync
#1

[eluser]the_unforgiven[/eluser]
Hi all,

I'm using codeigniter for a project and I need to be able to grab a JSON file from another server that will be using RSYNC to do this. Once they software guys send these files there will be a exe, dmg, tar.gz, json files I need to grab the json and then import into a database table so it can be used on the frontend of the site.

I haven't worked with CI for a while so desperatly in need of some help on this.

Thanks in advance.
#2

[eluser]CroNiX[/eluser]
Can you clarify a bit more? CI needs to use RSYNC to grab the file or the other company will RSYNC the file(s) to a local dir on your server?

What is the process for determining when the file needs to be imported to the db? Does this other company inform you that an update is ready or what? How often will this need to occur? There are probably a lot of various solutions, but to give a good answer it would be helpful to know more of a step-by-step on how the process is supposed to work.
#3

[eluser]the_unforgiven[/eluser]
The other company will use rsync to a dir on the server has far as I'm aware they will also inform us of the updates. Once the sync has took place on every occasion I need to get the json file then insert/update the db table with the new records.
#4

[eluser]CroNiX[/eluser]
Sounds fairly simple then. Maybe just a controller with a form where you enter the filename, or path/filename if there will be different dirs, and when you click a button use file_get_contents($path . $file) to read it and save it in the db. You could also use the directory helper and output a list of files in a given dir and turn them into links so when you click it it will read that file and import it into the db. Lots of ways to do this really.
#5

[eluser]the_unforgiven[/eluser]
Ah right got ya chronic once again your a legend thanks man
#6

[eluser]the_unforgiven[/eluser]
Don't suppose you could show me an example of how the code would look? Looking into this morning and having some issues thinking about how it should be written, like I said in my original post, not worked with Ci for a while so it's like it's all new again.




Theme © iAndrew 2016 - Forum software by © MyBB