后知后觉 发表于 2014-6-12 16:57:46

arduino和ENC28J60作为客户端访问网页问题


#include <net.h>
#include <EtherCard.h>

// ethernet interface mac address, must be unique on the LAN
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };

byte Ethernet::buffer;
static uint32_t timer;

char website[]= "www.lucadentella.it";

// called when the client request is complete
static void response_callback (byte status, word off, word len) {

Serial.print((const char*) Ethernet::buffer + off);
}

void setup () {
Serial.begin(9600);
Serial.println("\n");

if (ether.begin(sizeof Ethernet::buffer, mymac,10) == 0)
    Serial.println( "Failed to access Ethernet controller");
if (!ether.dhcpSetup())
    Serial.println("DHCP failed");

ether.printIp("IP:", ether.myip);
ether.printIp("GW:", ether.gwip);
ether.printIp("DNS: ", ether.dnsip);

if (!ether.dnsLookup(website))
    Serial.println("DNS failed");
   
ether.printIp("SRV: ", ether.hisip);

}

void loop () {
ether.packetLoop(ether.packetReceive());

if (millis() > timer) {
    timer = millis() + 10000;
    Serial.println();
    Serial.print("<<<REQ\n");
    ether.browseUrl(PSTR("/demo/"), "aphorisms.php", website, response_callback);
}
}

错误如下:
HTTP/1.1 406 Not Acceptable
Date: Thu, 12 Jun 2014 08:54:55 GMT
Server: Apache
Vary: Accept-Encoding
Content-Length: 101
Connection: close
Content-Type: text/html; charset=iso-8859-1

Blocked by mod_slotlimit. More information about this error may be available in the server error log.

此贴完全参照http://www.geek-workshop.com/thread-2098-1-1.html,并解决了DSN failed问题,解决方式是去掉char website[] PROGMEM = "www.lucadentella.it";中的PROGMEM。
求问题解决方法跟出现问题的原因。

弘毅 发表于 2014-6-12 17:44:00

好奇怪。。。我这里运行是正常的,难道是被墙了?换国内网站访问呢?

后知后觉 发表于 2014-6-12 18:13:36

弘毅 发表于 2014-6-12 17:44 static/image/common/back.gif
好奇怪。。。我这里运行是正常的,难道是被墙了?换国内网站访问呢?

不可能被屏蔽了,我在浏览器上输网址一点问题都没有

后知后觉 发表于 2014-6-12 18:37:28

你好弘毅哥

后知后觉 2014-6-12 18:33:50
我是在极客工坊发ENC28J60的那个人

后知后觉 2014-6-12 18:34:02
我发现了一个很奇怪的问题
http://www.vckbase.com/index.php/wenku

当我访问这个网址时他的返回没有问题




但是换成别的http://www.jizhuomi.com/software/339.html向这种使就不行


browseUrl的第二个参数是不能带后缀名的


但是我访问http://www.vckbase.com/index.php/video这个时同样不行

jkiu003 发表于 2014-6-12 23:11:17

我最近也在做

ChrisAndrew 发表于 2014-6-13 09:55:39

后知后觉 发表于 2014-6-12 18:37 static/image/common/back.gif
你好弘毅哥

后知后觉 2014-6-12 18:33:50


我测试了www.vckbase.com/index.php/video这个网址是可以的;但是www.jizhuomi.com/software/339.html确实是有点问题,应该是与browseUrl的参数有关系的。

后知后觉 发表于 2014-6-13 10:59:46

ChrisAndrew 发表于 2014-6-13 09:55 static/image/common/back.gif
我测试了www.vckbase.com/index.php/video这个网址是可以的;但是www.jizhuomi.com/software/339.html确实 ...

是啊,大多数带后缀名的网址都不行,比如鸡啄米网也不行,肯定跟参数有关,但是具体什么问题还是没有搞清楚

ChrisAndrew 发表于 2014-6-13 11:03:38

ChrisAndrew 发表于 2014-6-13 09:55 static/image/common/back.gif
我测试了www.vckbase.com/index.php/video这个网址是可以的;但是www.jizhuomi.com/software/339.html确实 ...

有关于EtherCard库中函数的具体解释文本没?

jkiu003 发表于 2014-6-19 11:16:02

解决了没?去掉PROGMEM会不会导致后门出问题?

蘰踄繧鍴灬 发表于 2014-9-8 00:38:57

我的去掉了 progmem 也是不行的~~~求解~
页: [1]
查看完整版本: arduino和ENC28J60作为客户端访问网页问题