Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection GET and build a project #89

Open
vmagalhaes opened this issue May 22, 2017 · 2 comments
Open

Connection GET and build a project #89

vmagalhaes opened this issue May 22, 2017 · 2 comments

Comments

@vmagalhaes
Copy link

vmagalhaes commented May 22, 2017

Hi,

I'm needing help to build a project and I'm looking to use this library for my ESP8266 module in my ARDUINO UNO.

I need the arduino reading the DB every time to receive a simple value 0 or 1, I just need to know how to receive this answer.

At the moment I am not able to make a code on the arduino with this library that makes the GET request work, could someone show me a code that would work? Thank you.

My PHP:

<?php
  $servername = "mysql.hostinger.com.br";
  $username = "root";
  $password = "*****";
  $dbname = "esp1";
  $conn = new mysqli($servername, $username, $password);
  
  header("content-type: application/json");

  $sql = "SELECT  * FROM `u582151594_esp82`.`esp1`";
  $result = $conn->query($sql);
  while($data = $result->fetch_object()) {
   $value = $data->value;      
  }
  
  echo '{"value":';
  echo $value;
  echo '}';
  
  $conn->close();
?>

The code returns me:
{"value":0}

I need the arduino to read this JSON, parse, and remove this VALUE for me to use in my code.

Some help?

Thankss

@igorleessa
Copy link

@igorleessa
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants