I have been running an application on an older original Raspberry Pi. The Raspberry Pi was running Incredible PBX and I have some tables set up in the MySQL database to store data received from an Arduino HTTP Get request that calls a PHP file. I have recently imaged the SD card and have tried running it in a new Raspberry Pi3. The issue I'm having is the newer Pi3 is showing a 400 Bad Request when Arduino sends the GET request. The Pi3 apache other_vhost_access logs show the Arduino request and also a successful request using Postman to send the HTTP request.
I would appreciate any help in how to successfully send HTTP request from Arduino to Pi3
Unsuccesful post from Arduino - localhost:80 192.168.50.21 - - [05/May/2019:09:21:03 -0400] "GET /add_data.php?ext=5000&room=212&callerid=212+TEST+PAGE" 400 506 "-" "-"
Sucessful post from Postman - localhost:80 192.168.50.145 - - [05/May/2019:09:29:27 -0400] "GET /add_data.php?ext=5000&room=110&callerid=110%20Emergency HTTP/1.1" 200 429 "-" "PostmanRuntime/7.11.0"
Arduino Code is -
if (client.connect(server, 80)) {
Serial.println("-> Connected and sending HTTP Request");
// Make a HTTP request:
client.print( "GET /add_data.php?"); //THIS SHOULD BE add_data.php
client.print("ext=");
client.print( extn );
client.print("&");
client.print("room=");
client.print( room );
client.print("&");
client.print("callerid=");
client.print( callerId2 );
client.println( " HTTP/1.1");
client.print( "Host: " );
client.println(server);
client.println( "Content-Type: application/x-www-form-urlencoded" );
client.println( "Connection: close" );
client.println();
client.println();
client.stop();
//Serial.print ("Room = " + room);
Serial.println ("HTTP Request proceesed and sent!"); Serial.println ("Database queries in process"); } else { // you didn't get a connection to the server: Serial.println("--> connection failed/n"); }
delay(interval);