This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.

problem with my lisp function

5 posts · 2104 views

I use this function to connect at a URL and get the html code of the page referenced by the URL. my problem is that the html code that I receive is not all of the code of the page

(defun connect-to-url (url filename)
(ext:with-http-input (stream url)

(with-open-file (stream2 filename :direction :output
:if-exists :overwrite
:if-does-not-exist :create )

(loop for line = (read-line stream nil nil)
while line
do (format stream2 line)))))

Re: problem with my lisp function

Here are a couple posting suggestions; unfortunately I don't have a system handy to test your problem.

First, specify which non-core packages you are using (e.g. where ext:with-http-input comes from).

Second, use the "
" blocks, good indentation, and preview so we don't have to specially parse :o.

Re: problem with my lisp function

 
(defun connect-to-url (url filename)
    (ext:with-http-input (stream url)
	
        (with-open-file (stream2  filename :direction :output
                                 :if-exists :overwrite
                                 :if-does-not-exist :create )

        	(loop for line = (read-line stream nil nil)
   	         while line
           	 do (format stream2 line)))))

Re: problem with my lisp function

(defun connect-to-url (url filename)
    (ext:with-http-input (stream url)
	
        (with-open-file (stream2  filename :direction :output
                                 :if-exists :overwrite
                                 :if-does-not-exist :create )

        	(loop for line = (read-line stream nil nil)
   	         while line
           	 do (format stream2 line)))))
to run it, write (connect-to-url("URL" " path of the file")

I have run it on the Clisp and my problem is that it not return all the contain of the web page