Jump to content

pmflav

Members
  • Posts

    7
  • Joined

  • Last visited

pmflav's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. pmflav

    json api

    anyone able to help with this one pls.
  2. Firstly I would like to say sorry if this has already been answered. Need to basic coding help to decode and output the following to a legible php file. http://cw.worldoftanks.asia/clanwars/maps/events/?action_filter=GH.Team I would like to echo the 'text' call for our website. Any help on this would be greatly appreciated, and please keep it simple for me, new to coding, so still learning. Thankyou
  3. Thankyou very much for the code above, and please do excuse me not knowing the basics. I am still a bit lost with the code. I don't know how to connect to the database and do the inserts with the above. Sorry
  4. This is what I have so far: $f = file_get_contents('http://worldoftanks.com/community/clans/api/1.0/?source_token=Intellect_Soft-WoT_Mobile-site&search=KST&offset=0&limit=1'); if(!function_exists('json_decode')) die('Your host does not support json'); $feed = json_decode($f); for ($i=0;$i<count($feed["data"]);$i++) { $sql = array(); foreach($feed['data'][$i] as $key => $value){ $sql[] = (is_numeric($value)) ? "`$key` = $value" : "`$key` = '" . mysql_real_escape_string($value) . "'"; } $sqlclause = implode(",",$sql); $rs = mysql_query("INSERT INTO items SET $sqlclause"); } // This is minus the mysql_connect at the start. However there seems to be a problem with: for ($i=0;$i<count($feed["data"]);$i++) Fatal error: Cannot use object of type stdClass as array
  5. At the moment I don't have any code, reading up and giving myself a crash course, but will definately post it here for any feedback as I am sure it won't be perfect initially. Thankyou again.
  6. Thankyou very much for that. Gives me a direction to look.
  7. I would just like to start by saying sorry if this is the wrong area. I am trying to import data from a a Game site API http://worldoftanks.com/community/clans/api/1.0/?source_token=WG-WoT_Assistant-test&search=KST&offset=0&limit=1, however I am not sure where to start with this one. It doesn't appear to be standard xml. What I am trying to do is create a script on my website which will read this page and import the data into the database, and via a cron will update it every day. A tap in the right direction with this one would be a great help. Thankyou in advance
×
×
  • 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.