极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 17441|回复: 9

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

[复制链接]
发表于 2014-6-12 16:57:46 | 显示全部楼层 |阅读模式
[pre lang="arduino" line="1" file="ClientIP"]
#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[800];
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[webClient]");

  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);
  }
}
[/code]
错误如下:
  1. HTTP/1.1 406 Not Acceptable
  2. Date: Thu, 12 Jun 2014 08:54:55 GMT
  3. Server: Apache
  4. Vary: Accept-Encoding
  5. Content-Length: 101
  6. Connection: close
  7. Content-Type: text/html; charset=iso-8859-1

  8. 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
好奇怪。。。我这里运行是正常的,难道是被墙了?换国内网站访问呢?

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

使用道具 举报

 楼主| 发表于 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这个时同样不行
回复 支持 反对

使用道具 举报

发表于 2014-6-12 23:11:17 | 显示全部楼层
我最近也在做
回复 支持 反对

使用道具 举报

发表于 2014-6-13 09:55:39 | 显示全部楼层
后知后觉 发表于 2014-6-12 18:37
你好弘毅哥

后知后觉 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
我测试了www.vckbase.com/index.php/video这个网址是可以的;但是www.jizhuomi.com/software/339.html确实 ...

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

使用道具 举报

发表于 2014-6-13 11:03:38 | 显示全部楼层
ChrisAndrew 发表于 2014-6-13 09:55
我测试了www.vckbase.com/index.php/video这个网址是可以的;但是www.jizhuomi.com/software/339.html确实 ...

有关于EtherCard库中函数的具体解释文本没?
回复 支持 反对

使用道具 举报

发表于 2014-6-19 11:16:02 | 显示全部楼层
解决了没?去掉PROGMEM会不会导致后门出问题?
回复 支持 反对

使用道具 举报

发表于 2014-9-8 00:38:57 | 显示全部楼层
我的去掉了 progmem 也是不行的~~~求解~
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|联系我们|极客工坊

GMT+8, 2026-6-8 08:07 , Processed in 0.036226 second(s), 22 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表