Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $opts = array(
- 'http'=>array(
- 'method'=>"GET",
- 'header'=>"Authorization: Bearer {$access_token}rn",
- 'Content-Type'=>"application/x-www-form-urlencoded"));
- $context = stream_context_create($opts);
- // Open the file using the HTTP headers set above
- $response = file_get_contents($url, false, $context);
- $user = json_decode($response, true);
- return $user['data'];
- }
- // open mysql connection
- $host = "localhost";
- $username = "root";
- $password = "5984";
- $dbname = "test";
- $con = mysqli_connect($host, $username, $password, $dbname);
- if(mysqli_connect_errno($con)){
- echo "fail!";
- }
- else{
- echo "success!";
- $result = mysqli_query($con, "select * from testtable");.
- while($row = mysqli_fetch_array($result)){
- echo $row['column1'];
- echo " ";
- }}
- foreach($user as $item){
- mysqli_query($con, "INSERT INTO testtable (column1, column2, column3,column4,
- column5) VALUES ('".$item['time_updated']."','".$item['time_created']."',
- '".$item['date']."','".$item['resting_heartrate']."', '".$item['place_lat']."')");}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement