Вопрос

I am trying to use clisp to dump webpages like, e.g. to define a function "read-url", such that (read-url "http://www.kernel.org/index.html") would display the html source code like:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- $Id: index.shtml,v 1.422 2012/02/09 17:13:11 root Exp $ -->



<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  <title>The Linux Kernel Archives</title>
  <link rel="icon" type="image/png" href="favicon.ico" />
  <link rel="alternate" type="application/rss+xml"
        title="Latest Linux Kernel Version RSS"
        href="http://kernel.org/kdist/rss.xml" />
  <link rel="stylesheet" href="/kernel.css" type="text/css" />
......

does anyone know how? Many thanks!!

Это было полезно?

Решение

I would recommend using drakma: "a fully-featured web client".

Where you could easily write a function as:

(defun read-url (url)
   (drakma:http-request url))

which will then return the corresponding (sent back by the server) html-code. It works very well and (as far as I explored it) bug-less.

Другие советы

try CLOCC/CLLIB/url.lisp, see with-open-url, url-get &c.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top