Ethernet Shield to UPC site
hi there,
i'm testing dnswebclient example come arduino ide.
version 23
ethernet shield - sparkfun, received it.
arduino uno
using example dnswebclient sketch, i'm trying connect upc site , retrieve product information using barcode. in case rice mix.
i receive "404 not found " error.
works fine if use string in browser, returns info.
i have not able find topics on , wondering if has seen issue?
the code , return data included below. did not change example except url.
tested google example , worked fine.
thanks
randy
message returns
i'm testing dnswebclient example come arduino ide.
version 23
ethernet shield - sparkfun, received it.
arduino uno
using example dnswebclient sketch, i'm trying connect upc site , retrieve product information using barcode. in case rice mix.
i receive "404 not found " error.
works fine if use string in browser, returns info.
i have not able find topics on , wondering if has seen issue?
the code , return data included below. did not change example except url.
tested google example , worked fine.
thanks
randy
code: [select]
/*
web client
sketch connects website (http://www.google.com)
using arduino wiznet ethernet shield.
circuit:
* ethernet shield attached pins 10, 11, 12, 13
api key - c4f9ccc27f967b1cc0ba3c5fde92f3a8
www.upcdatabase.org/api/xml/c4f9ccc27f967b1cc0ba3c5fde92f3a8/upcgoeshere
output if exists
<?xml version="1.0" encoding="iso-8859-1"?>
<output xmlns="http://www.upcdatabase.org/">
<valid>true</valid>
<number>0111222333444</number>
<itemname>upc database testing code</itemname>
<description>http://www.upcdatabase.org/code/0111222333444</description>
<price>123.45</price>
<ratingsup>2</ratingsup>
<ratingsdown>0</ratingsdown>
</output>
output if error
<?xml version="1.0" encoding="iso-8859-1"?>
<output xmlns="http://www.upcdatabase.org/">
<valid>false</valid>
<error>301</error>
<reason>code not exist!</reason>
</output>
error codes:
101 - api key length incorrect
105 - api key incorrect
201 - did not enter code
205 - code entered non-numeric
301 - code not exist
created 18 dec 2009
david a. mellis
*/
#include <spi.h>
#include <ethernet.h>
// enter mac address controller below.
// newer ethernet shields have mac address printed on sticker on shield
byte mac[] = { 0xde, 0xad, 0xbe, 0xef, 0xfe, 0xed };
ipaddress server(174,122,37,98); // www.upcdatabase.org
string testupc = "071429097056";
char servername[] = "www.upcdatabase.org";
// initialize ethernet client library
// ip address , port of server
// want connect (port 80 default http):
ethernetclient client;
void setup() {
// start serial library:
serial.begin(9600);
// start ethernet connection:
if (ethernet.begin(mac) == 0) {
serial.println("failed configure ethernet using dhcp");
// no point in carrying on, nothing forevermore:
for(;;)
;
}
// give ethernet shield second initialize:
delay(1000);
serial.println("connecting...");
// if connection, report via serial:
if (client.connect(servername, 80)) {
serial.println("connected");
// make http request:
client.println("get /api/xml/c4f9ccc27f967b1cc0ba3c5fde92f3a8/071429097056 http/1.0"); //http/1.0
client.println();
}
else {
// kf didn't connection server:
serial.println("connection failed");
}
}
void loop()
{
// if there incoming bytes available
// server, read them , print them:
if (client.available()) {
char c = client.read();
serial.print(c);
}
// if server's disconnected, stop client:
if (!client.connected()) {
serial.println();
serial.println("disconnecting.");
client.stop();
// nothing forevermore:
for(;;)
;
}
}message returns
code: [select]
connected
http/1.1 404 not found
date: sat, 17 dec 2011 03:08:03 gmt
server: apache/2.2.21 (unix) mod_ssl/2.2.21 openssl/0.9.8e-fips-rhel5 mod_fcgid/2.3.6 phusion_passenger/3.0.9 mod_bwlimited/1.4
accept-ranges: bytes
connection: close
content-type: text/html
x-pad: avoid browser bug
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html>
<head>
<title>404 not found</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style type="text/css">
body {
font-family: verdana, arial, helvetica, sans-serif;
font-size: 12px;
background-color:#367e8e;
scrollbar-base-color: #005b70;
scrollbar-arrow-color: #f3960b;
scrollbar-darkshadow-color: #000000;
color: #ffffff;
margin:0;
}
{ color:#021f25; text-decoration:none}
h1 {
font-size: 18px;
color: #fb9802;
padding-bottom: 10px;
background-image: url(sys_cpanel/images/bottombody.jpg);
background-repeat: repeat-x;
padding:5px 0 10px 15px;
margin:0;
}
#body-content p {
padding-left: 25px;
padding-right: 25px;
line-height: 18px;
padding-top: 5px;
padding-bottom: 5px;
}
h2 {
font-size: 14px;
font-weight: bold;
color: #ff9900;
padding-left: 15px;
}
</style>
</head>
<body>
<div id="body-content">
<!-- start content-->
<!--
instead of request_uri, show absolute url via:
http://http_host/request_uri
if https:// or other protocol?
server_port_secure doesn't seem used
server_port logic break if use alternate ports
-->
<h1>404 not found</h1>
<p>the server can not find requested page:</p>
<blockquote>
(none)/api/xml/c4f9ccc27f967b1cc0ba3c5fde92f3a8/071429097056 (port 80)
</blockquote>
<p>
please forward error screen zemni.site5.com's
<a href="mailto:system-notifications@monitor.accountsupportgroup.com?subject=error message [404] 404 not found (none)/api/xml/c4f9ccc27f967b1cc0ba3c5fde92f3a8/071429097056 port 80 on friday, 16-dec-2011 21:08:03 cst">
webmaster</a>.
</p>
<hr />
<address>apache/2.2.21 (unix) mod_ssl/2.2.21 openssl/0.9.8e-fips-rhel5 mod_fcgid/2.3.6 phusion_passenger/3.0.9 mod_bwlimited/1.4 server @ zemni.site5.com port 80</address>
<!-- end content -->
</div>
</body>
</html>
disconnecting.
can use network sniffer (running on pc) analyze sent on wire?
christoph
christoph
Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > Ethernet Shield to UPC site
arduino
Comments
Post a Comment