element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum Upload a parameter to a web page
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 9 replies
  • Subscribers 403 subscribers
  • Views 542 views
  • Users 0 members are here
Related

Upload a parameter to a web page

Former Member
Former Member over 13 years ago

Hello,

 

My project is to use the Arduino as a datalogger (for temperature and gas consumption).

The temperature measurement and gas counter work fine.

I would like now to transmit these data to a web page.

 

The web page is ready to receive the data : this is the url used with my web brower to transmit data :

http://www.xx/NS1.php?P1=counter_value

When the parameter is received, the web page sends an email.

 

Now I would like to do the same thing with the arduino.

But it doesn’t work : there is no error message but the web page is simply not activated. This is the code used :

 

#include <SPI.h>

#include <Ethernet.h>

 

byte mac[] = {  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

IPAddress server(xx,xx,xx,xx); //my web site IP adress

EthernetClient client;

 

void setup() {

  delay(3000);

  Serial.begin(9600);

  Serial.println("Starting...");

  if (Ethernet.begin(mac) == 0) {

     Serial.println("Failed to configure Ethernet using DHCP");

  }

 

  delay(1000);

  Serial.println("connecting...");

 

  if (client.connect(server, 80)) {

      Serial.println("connected");

      client.println("http://www.xxx.NS1.php?P1=counter_value");

      client.println();

      Serial.println("Request sent");

  }

  else {

      Serial.println("connection failed");

  }

}

 

void loop()

{

}

 

Do you have an idea of what is wrong ?

Thanks for your help.

  • Sign in to reply
  • Cancel
Parents
  • fustini
    fustini over 13 years ago

    Do you see the serial output from the Arduino ok?  For example, does it print "connected".

     

    On the server, does the access log for the web server show requests for "http://www.xxx.NS1.php?P1=counter_value"?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 13 years ago in reply to fustini

    Hello thanks for your reply.

     

    Yes on the serial output the messages are displayed : "connected" and "request sent"

     

    I can ping the Arduino from my computer without problem.

     

    Actually I do not have access to server access log.

     

    Thanks again for your help.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • fustini
    fustini over 13 years ago in reply to Former Member

    That's too bad about the access log.  It would be good to know if the server receives the request at all or not.

     

    Were you able to run the default Ethernet example?  Were it just does a simple GET from Google?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • fustini
    fustini over 13 years ago in reply to fustini

    BTW, you can also call client.connect() with a domain name like client.connect("yourdomain.com", 80) if you want to rule out the off chance that you have the wrong ip address.

     

    Also, when I was troubleshooting the WiFly shield which uses similar library, it was very useful to insert debug serial print statements inside the lower level read and write calls to see all the data that was going back forth.  You might be able to something similar in utility/socket.cpp or utility/w5100.h.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 13 years ago in reply to fustini

    Hello Drew,

     

    The Webclient sample works fine.

    I have just changed IPAddress server(173,194,67,94); // Google

     

    I have tried client.connect("yourdomain.com", 80); // no change

     

    You have right, I must see the server access log.

    I have asked to my provider but no response up to now.

     

    Thanks again for your help.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • Former Member
    Former Member over 13 years ago in reply to fustini

    Hello Drew,

     

    The Webclient sample works fine.

    I have just changed IPAddress server(173,194,67,94); // Google

     

    I have tried client.connect("yourdomain.com", 80); // no change

     

    You have right, I must see the server access log.

    I have asked to my provider but no response up to now.

     

    Thanks again for your help.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube