作者SnowWolf.bbs@processor.tfcis.org (靜夜) 看板: plan
標題Re: [轉錄][WindTop]新浪星座運勢查詢
時間XEON (Sun, 20 Jul 2003 13:08:48 +0800 (CST))
他是用socket抓不是用lynx....
以下為改用proxy的範例....
: 首先加入 proxy server
#define REF "http://www.dreye.com.tw/"
- #define HTTP_PORT 80
+ #define PROXY_HREF "proxy.tku.edu.tw" //依各站自定
+ #define PROXY_PORT 3128
: 把 HTTP_PORT 改成 PROXY_PORT
- if ((sockfd = dns_open(server, HTTP_PORT)) < 0)
+ if ((sockfd = dns_open(server, PROXY_PORT)) < 0)
{
vmsg("無法與伺服器取得連結,查詢失敗");
: 原本是 http_conn 直接連到服務,改成連去 proxy
- sprintf(sendform, "GET %s?%s HTTP/1.0\n\n", CGI_dreye, atrn);
+ sprintf(sendform, "GET %s%s?%s HTTP/1.0\n\n", REF, CGI_dreye, atrn);
- http_conn(SERVER_dreye, sendform);
+ http_conn(PROXY_HREF, sendform);
--
| Origin | MapleBBS-itoc 動力核心 processor.tfcis.org
| Author | 218-172-166-180.hinet-ip.hinet.net