Newbie Q: How to save XML data into Database? |
[eluser]Unknown[/eluser]
The Goal: I would like to save specific pieces of data from Twitter's "show/users" method (specifically, a user's follower_count and friends_count) into a database. The purpose is to track these two pieces of data over time. What I've Done So Far: Still learning CI, so I started from scratch and installed CI 1.7.2. I found Phil Sturgeon's very cool REST Client app on Github -- installed that. I created my controller per Phil's example: Code: <?php I was able to see the results as planned. Now I created my model (this is where I start running into trouble): Code: <?php I can see that the model is getting hit by viewing the print_r, but I can't seem to figure out how to pull the pieces of the xml result into my database. I plan on using SimpleXML for this, but if there's a better solution, I'm all ears. BTW, all of the necessary libraries (database, curl, and simplexml) and model have been autoloaded. Any ideas?
[eluser]Christopher Blankenship[/eluser]
ci_newbie: To help in your model visually in the function addInfo add the following: Code: print "<pre>"; From that you will then be able to see the data more structured for reading. Then to start utilizing SimpleXML see the following: http://us.php.net/manual/en/simplexml.ex...-basic.php Enjoy! |
Welcome Guest, Not a member yet? Register Sign In |