CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   DOM and JSON scripting (http://www.codingforums.com/forumdisplay.php?f=15)
-   -   JSON response form server--Urgent (http://www.codingforums.com/showthread.php?t=286201)

greeki78 01-21-2013 04:09 PM

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.

sunfighter 01-22-2013 04:10 PM

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'};
?>



All times are GMT +1. The time now is 02:46 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.