Problem sending data from Arduino to a specific URL.

I need to send a data from the arduino to a specific URL. However, I can't find the proper code for this. I am using an Arduino Uno and Adafruit CC3000 shield to connect to the internet. Do you guys know what the correct syntax is? I just need to send the value of a variable to that specific URL. Thanks!

I need to send a data from the arduino to a specific URL.

Which one? What is the problem? What have you tried?

Do you guys know what the correct syntax is?

Of course. You make a GET request, exactly the example shows.

Here's a sample of my code. It's suppose to send a string which is the "request" to a sample webpage "dev.website.com/folder"

if (client.connected()) 
    {
      client.println(F("POST /folder/ HTTP/1.1")); //sample webpage
      client.println(F("Host: dev.website.com")); //not real site
      client.println(F("Content-Type: text/html; charset=UTF-8"));
      client.println("Connection: keep-alive");
      client.print(F("Content-Length: "));
      client.println(request.length());
      client.println();
     
      client.println(request);      
      client.println(F(""));
      Serial.println("Connected & Data sent");
    }

It's suppose to send a string which is the "request" to a sample webpage "dev.website.com/folder"

So, what is the problem? What does it ACTUALLY do? What does it not do?

We are trying to send a string data to that specific url but we are not sure what is the proper code using the post request and without using any php. That link is already programmed to use that string data. So we are just concerned on how to make it happen.

Without seeing the rest of your code, that is the correct format for a POST send. What does the server send as a response?

You might want to insure it is sent to the right page.

      client.println(F("POST /folder/pagename.php HTTP/1.1")); //sample webpage

Oops! My bad. I just saw something else not correct. The Content-Type is incorrect. It should be this:

      client.println(F("Content-Type: application/x-www-form-urlencoded"));

What is "pagename.php" for? All we have is the specific URL which is "dev.website.com/folder". Do we need to know the .php file?

marksampayan:
What is "pagename.php" for? All we have is the specific URL which is "dev.website.com/folder". Do we need to know the .php file?

If you are certain the server default page is the page to which you are sending your request, then it is not needed. I prefer to use the page name if there is any doubt.

Did you see the edit to my post? The Content-Type is not correct.

edit: Most servers do not use a .php file as the default.

So if the server does not use a .php file, what should the code be? from the previous line of code that you sent.

These are the simple questions. Are you sure you have the experience to try this as an Arduino project?

Do you know what the default page is on your server? It is the page the server sends if you do not include the page name with the request. What did you name the page you are sending the request to on the server?

As I recall, the default page name is index.html on Apache, and default.html on IIS.

SurferTim:
These are the simple questions. Are you sure you have the experience to try this as an Arduino project?

Do you know what the default page is on your server? It is the page the server sends if you do not include the page name with the request. What did you name the page you are sending the request to on the server?

As I recall, the default page name is index.html on Apache, and default.html on IIS.

from the sample webpage I posted, the default page is dev.website.com and the page where I want to send is dev.website.com/folder

marksampayan:
from the sample webpage I posted, the default page is dev.website.com and the page where I want to send is dev.website.com/folder

No, it is not. The "dev.website.com" is the domain name. The "/folder/" is a directory name on the server. The server will append a page name to that directory name.

With Apache, it will be "http://dev.website.com/folder/index.html" unless the server administrator changed that in the configuration files for Apache.

SurferTim:

marksampayan:
from the sample webpage I posted, the default page is dev.website.com and the page where I want to send is dev.website.com/folder

No, it is not. The "dev.website.com" is the domain name. The "/folder/" is a directory name on the server. The server will append a page name to that directory name.

With Apache, it will be "http://dev.website.com/folder/index.html" unless the server administrator changed that in the configuration files for Apache.

I think you misinterpreted me. The "folder" is the page name. I just used the name "folder" for the webpage. Sorry for that.

The "folder" is the page name. I just used the name "folder" for the webpage. Sorry for that.

You called the file "folder"? No extension? I think it's time you fixed that colossal blunder.

In your code, "/folder/" is a directory. Note the slash following "/folder". That denotes a directory, not a file name.

      client.println(F("POST /folder/ HTTP/1.1")); //sample webpage

SurferTim:
In your code, "/folder/" is a directory. Note the slash following "/folder". That denotes a directory, not a file name.

      client.println(F("POST /folder/ HTTP/1.1")); //sample webpage

sorry, so this

client.println(F("POST /folder/ HTTP/1.1")); //sample webpage

should be changed to

client.println(F("POST /folder HTTP/1.1")); //sample webpage

No. If you didn't follow PaulS's advice and rename that file, then you should. At least add a file extension to it so you can recover the data you are sending it, like folder.php.

do you have a good understanding of what is going on with the server? What do you expect the server to be doing when your client connects to it and provides the data in the POST format?