Sending data to a page using the ESP8266-01 wifi-module from Arduino

0 votes

Hi friends, I've been using my Arduino Uno to put together an attendance system through a rfid reader using an esp8266-01 wifi module. What need is to do is store the unique id number in a database after reading it from a webpage where the rfid card publishes it. The webpage is coded in PHP. And, I've been sending commands to the Wi-Fi module from arduino ide serial monitor through the Uno board.
I initially tried using Serial_ophttp POST method to send it to the webpage and also the GET method, but couldn't get it to work.

    <?php
    error_reporting(E_ALL ^ E_DEPRECATED);
    $dbhost = 'localhost';
    $dbuser = 'root';
    $dbpass = '';
    $conn = mysql_connect($dbhost, $dbuser, $dbpass);
    if(! $conn ) {
    die('Could not connect: ' . mysql_error());
    }
    $Data=$_GET['Data'];
    //$Data='Data test';
    echo "Data is :" . $Data;
    $sql = "INSERT INTO test_tab (Data) VALUES ('$Data')";
    mysql_select_db('robot');
    $retval = mysql_query( $sql, $conn );
    if(! $retval ) {
    die('Could not enter data: ' . mysql_error());
    }   
    echo "Entered data successfully\n";
    mysql_close($conn);
    ?>

Aug 9, 2018 in IoT (Internet of Things) by Bharani
• 4,660 points
1,997 views

1 answer to this question.

0 votes

Well, I think there are some \r \n missing in them and also, the AT+CIPSEND is being sent the wrong length.
You should try sending it again, like this:

AT+CIPSEND=43\r\n
GET /test.php?Data=2\r\nHost:192.168.1.13\r\n\r\n

Just hit enter to send \r\n and ensure that you select "Both NL & CR" in your serial monitor. And of course, you will need to hit Enter twice at the end.

So, here I am sending 2 as my value and hence, after subtracting the 1 for every \r & \n from the size o your GET(), i.e., 49 will become 49 - 6 = 43.

Try to send the value directly from the URL and make sure that your PHP script is error-free and working. 

answered Aug 9, 2018 by nirvana
• 3,130 points

Related Questions In IoT (Internet of Things)

0 votes
1 answer

How to use the data I receive from Azure IoT Hub?

The payload you receive will be a ...READ MORE

answered Aug 1, 2018 in IoT (Internet of Things) by DataKing99
• 8,250 points
1,790 views
0 votes
1 answer

Transfer Data from Arduino Board to SQL Server

If you want to send it to ...READ MORE

answered Aug 29, 2018 in IoT (Internet of Things) by anonymous2
• 4,280 points
4,839 views
0 votes
1 answer
0 votes
1 answer

Arduino to pubnub cloud using esp8266

With the ESP8266, it always better to ...READ MORE

answered Oct 27, 2018 in IoT (Internet of Things) by Siddhant
• 210 points
1,025 views
0 votes
1 answer

Using ESP8266 for controlling through Arduino

Please explain better your problem. In Arduino-Esp8266 String ...READ MORE

answered Sep 11, 2018 in IoT (Internet of Things) by anonymous2
• 4,280 points
774 views
0 votes
1 answer

How to send a data from arduino uno to a webpage through esp8266 wifi module?

You are missing a few \r\n and the length ...READ MORE

answered Aug 9, 2018 in IoT (Internet of Things) by anonymous2
• 4,280 points
3,644 views
0 votes
1 answer

Faster communication between two ESP8266 in client-server setup

Try following. Server loop void loop() { // ...READ MORE

answered Jul 13, 2018 in IoT (Internet of Things) by anonymous2
• 4,280 points
6,813 views
0 votes
1 answer

MQTT on ESP8266 with NodeMCU - problems with publishing

Perhaps this was solved by more recent ...READ MORE

answered Aug 13, 2018 in IoT (Internet of Things) by anonymous2
• 4,280 points
1,982 views
0 votes
1 answer

Connect Android Things based Raspberry Pi 3 to wifi network for the first time!

Hey, I think its alright!  Your Raspberry Pi ...READ MORE

answered Jul 19, 2018 in IoT (Internet of Things) by nirvana
• 3,130 points
1,135 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP