but if tryied to use AT command nothing I receive to MySQL.
AT+SAPBR=3,1,"Contype","GPRS"
Ok
AT+SAPBR=3,1,"APN","taif"
Ok
AT+SAPBR =1,1
Ok
AT+SAPBR=2,1
+SAPBR=1,1,"10.176.90.111"
AT+HTTPINIT
Ok
AT+HTTPPARA="CID",1
Ok
AT+HTTPPARA="URL","http://marsinnovations.in/testout.php"
Ok
AT+HTTPACTION=0
Ok
AT+HTTPREAD
Ok
+HTTPACTION:0,601,0
So what really is the problem and why i can't receive any data? Please need your help
I am no expert in the AT commands used by your GPRS shield. Having said that, I expected to see the same url that you used in the browser to be in your AT commands somewhere, but it isnt. Why not?
Not sure you understood the point I was making. Try this:
AT+SAPBR=3,1,"Contype","GPRS"
Ok
AT+SAPBR=3,1,"APN","taif"
Ok
AT+SAPBR =1,1
Ok
AT+SAPBR=2,1
+SAPBR=1,1,"10.176.90.111"
AT+HTTPINIT
Ok
AT+HTTPPARA="CID",1
Ok
AT+HTTPPARA="URL","http://localhost/write_data.php?addLati=23.02&addLongti=23.2"
Ok
AThttp://localhost/write_data.php?addLati=23.02&addLongti=23.2+HTTPACTION=0
Ok
AT+HTTPREAD
Ok
+HTTPACTION:0,601,0
localhost is my host name of MySQL database server, i am using WampServer, and having php file in order to push arduino data to the database, my php file:
<?php
// Prepare variables for database connection
$dbusername = "****"; // enter database username, I used "arduino" in step 2.2
$dbpassword = "****"; // enter database password, I used "arduinotest" in step 2.2
$server = "localhost"; // IMPORTANT: if you are using XAMPP enter "localhost", but if you have an online website enter its address, ie."www.yourwebsite.com"
// Connect to your database
$dbconnect = mysql_pconnect($server, $dbusername, $dbpassword);
$dbselect = mysql_select_db("test",$dbconnect);
// Prepare the SQL statement
$sql = "INSERT INTO test.sensor (Latitude, Longtitude) VALUES ('".$_GET["addLati"]."','".$_GET["addLongti"]."')";
// Execute SQL statement
mysql_query($sql);
?>
You do realize that "localhost" is the nickname for the machine you are on at the time will work if your server is on the same machine as your code, but nobody else can resolve that to anything other than the machine trying to resolve it? You can't talk from one machine to "localhost" on another machine unless you have actually managed to create a machine with the name "localhost" in which case all bets are off. Look at the IP address for localhost - it is the loopback address.
yes i do believe, so what do you advice me to do to resolve the problem now? shall i change my web server software? i am using wampserver what should i use and please do not say it is impossible i am having final project and need to get it work quickly. thank you.
On your PC, you have an installation of MySQL, PHP managed by WAMP Server.
You have tested this installation by issuing a command through on this PC and demonstrated that you are able put data into the local SQL Database.
You have got an Arduino with the sim900 GPRS SHIELD and you want to issue commands from the Arduino to the GPRS Shield such that the GPRS Shield will contact your PC and load data onto your MySQL Database, simulating what you did in Internet Explorer directly on the PC.
The path between the GPRS Shield and your PC at home is quite long although these might physically be close together. The GPRS Shield must build a session over the network of the data provider that issued your SIM card, through the internet, all the way through to your home router then to your PC.
The solution probably involves (a) discovering what the publicly routeable IP address is that your internet service provider has allocated to your PC (often these change from time to time) and (b) maybe making a configuration setting on your home router to route HTTP traffic (port 80) to your PC, then (c) modifying your command to use that IP address in place of the host name 'localhost'.
The problem is exactly the same as if you were in an internet café and wanted to contact your home PC's MySQL installation from there, using the test commands you have tried.
Hint: You can see the publicly routeable IP address of the PC you used to create a post in this thread under your "Karma" points !
hint 2. It could be that your home PC is connected directly to the internet (ie not over a router) say with a cable modem. In this case, it is even easier. But you may then have to play with Windows firewall settings.
How is your home PC connected to the internet ? though a router ? If if is, you'll almost certainly have to set up a port forwarding in the router to allow and direct incoming http requests directly to you PC. If you have a router, look at this video for making your PC accessible over the internet: Make A Website Publicly accessible with Port Forwarding Linksys Router - YouTube
Your address of 10.153.50.175 is not going to be directly available from the outside world - you have a router in between you and the outside and it is handing out a private address to your PC. See this article on Private Network Addresses for more information. To get to that address from the outside (internet), you will need to add port forwarding in your router to forward requests from the outside to that specific machine. The private network addresses are (in general) non-routable meaning that when you try to go to or from them to somewhere outside the local network, the router will not pass it along. If you go into the router and look at the configuration, you will see that the WAN side will have an entirely different address that is NOT part of the ranges specified for the "private networks" the router then translates conversations to/from the machines behind it on the LAN (local network) to the other address on the local network. That is called NAT (Network Address Translation)
yes i did tried to use my phone browser which accessing internet from the same sim card that i use and try to log to http://10.153.50.175/write_data.php?addLati=4
and i could not access as well as i was not able to update my database.
but if my phone is connected to my home Internet wifi network i can access and also get update on my database. why??
i feel there is something closed or blocked in case of mobile network
Go back and read what I wrote (and the links again). Your mobile network is accessing things from the outside (internet) not the local network. You can't get to a private IP address unless you configure the router to allow it through.
gpsmikey, i have done configuration of Port forwarding to my TP-LINK ROUTER, but i'm having some Question:
How many Virtual Server should i create? Which type of protocol should i use?how about the service port and the firewall?
i did but still having problem not able to access my DB from my phone. I have TP-LING ADSL2+ Modem Router.