Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-21-2013, 04:09 PM   PM User | #1
greeki78
New to the CF scene

 
Join Date: Jan 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
greeki78 is an unknown quantity at this point
JSON response form server--Urgent

Hi All,
I'm copy an API on web browser (Its like this).I get response,
https://fridaycamp.ca/api/v1/version...1becbb188b91ed....

I get response
{"status": "ok", "version": "1.1.0"}


I have sample other responses where I get by using cURL.

I need to extract this data from the server and load it into another server.I'm horribly confused.

Here's the whole picture.

We have original data on server1
We can access the server1 data using only API requests.I sent API request to server1 and got the responses in JSON.
I need to extract the data from JSON responses and then load into SQL server which is on server2.
I'm connected to server 2(that's where I have to write the code to extract the data)

What is the best way to extract this data from server1 to server2?

Should I write Java script/PHP to extract the data from server1 and load it into server2?

Should it be written in Phython?or ......?

Any ideas would be appreciated at this point of time.

It's very urgent.

Thank You.
greeki78 is offline   Reply With Quote
Old 01-22-2013, 04:10 PM   PM User | #2
sunfighter
Senior Coder

 
Join Date: Jan 2011
Location: Missouri
Posts: 2,498
Thanks: 18
Thanked 362 Times in 361 Posts
sunfighter is on a distinguished road
Quote:
I get response
{"status": "ok", "version": "1.1.0"}
I don't think that's correct. In this case i think json sends you a string that looks like that and you printed the string. Use PHP because you want to enter data into a database.

Something to help you see whats going on:
PHP Code:
<?php
$string 
'{"status": "ok", "version": "1.1.0"}';  // THE VARIABLE $string IS WHAT IS SENT TO YOU

/*  DID THID SO YOU CAN SEE THE JSON STRING DECODED  */
$decoded json_decode($string);
print 
"Status: ".$decoded->{'status'}."<br />";
print 
"Version: ".$decoded->{'version'};

/*  OR USE THESE VARIABLES TO ADD INFO TO THE DATBASE  */
$status $decoded->{'status'};
$version $decoded->{'version'};
?>
sunfighter is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:13 PM.


Advertisement
Log in to turn off these ads.