* Stripping HTTP headers from an HTTP response?
@ 2009-12-15 13:28 Elena
2009-12-15 14:44 ` Klaus Straubinger
0 siblings, 1 reply; 5+ messages in thread
From: Elena @ 2009-12-15 13:28 UTC (permalink / raw
To: help-gnu-emacs
Hello,
I'd like to get some HTML documents via HTTP for processing. I'm using
`url-retrieve-synchronously' to retrieve the HTTP response and it
works. However it returns the full HTTP response (that is: including
headers) and it seems there is not a function to extract the embedded
HTML document. Should I just strip lines until the first empty one, or
there is a better way?
I've tried the package `http-get.el' but it hangs Emacs for a while
before failing, maybe because I'm beyond a proxy.
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Stripping HTTP headers from an HTTP response?
2009-12-15 13:28 Stripping HTTP headers from an HTTP response? Elena
@ 2009-12-15 14:44 ` Klaus Straubinger
2009-12-15 15:34 ` Elena
2009-12-15 21:50 ` Tim X
0 siblings, 2 replies; 5+ messages in thread
From: Klaus Straubinger @ 2009-12-15 14:44 UTC (permalink / raw
To: help-gnu-emacs
Elena <egarrulo@gmail.com> wrote:
> I'd like to get some HTML documents via HTTP for processing.
url-insert-file-contents is a good function to use for that purpose,
probably in a temporary buffer.
For interactive use, you could also try browse-url-emacs.
> Should I just strip lines until the first empty one
This works, too.
--
Klaus Straubinger
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Stripping HTTP headers from an HTTP response?
2009-12-15 14:44 ` Klaus Straubinger
@ 2009-12-15 15:34 ` Elena
2009-12-15 21:50 ` Tim X
1 sibling, 0 replies; 5+ messages in thread
From: Elena @ 2009-12-15 15:34 UTC (permalink / raw
To: help-gnu-emacs
On 15 Dic, 14:44, Klaus Straubinger <KSN...@UseNet.ArcorNews.DE>
wrote:
> Elena <egarr...@gmail.com> wrote:
> > I'd like to get some HTML documents via HTTP for processing.
>
> url-insert-file-contents is a good function to use for that purpose,
That's exactly what I was after. Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Stripping HTTP headers from an HTTP response?
2009-12-15 14:44 ` Klaus Straubinger
2009-12-15 15:34 ` Elena
@ 2009-12-15 21:50 ` Tim X
2009-12-16 7:31 ` Klaus Straubinger
1 sibling, 1 reply; 5+ messages in thread
From: Tim X @ 2009-12-15 21:50 UTC (permalink / raw
To: help-gnu-emacs
Klaus Straubinger <KSNetz@UseNet.ArcorNews.DE> writes:
> Elena <egarrulo@gmail.com> wrote:
>
>> I'd like to get some HTML documents via HTTP for processing.
>
> url-insert-file-contents is a good function to use for that purpose,
> probably in a temporary buffer.
>
> For interactive use, you could also try browse-url-emacs.
>
>> Should I just strip lines until the first empty one
>
> This works, too.
There is also wget.el, which provides an interface to wget, which will
work through a proxy. However, from memory (which is a bit rusty), I
seem to remember there was either a function in url.el which would
either strip the headers or return the contents without headers. Check
for optional arguments on some of the functions. There is also an
interface to curl for emacs.
Another place to get some ideas would be the sources to emacs w3.
Tim
--
tcross (at) rapttech dot com dot au
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Stripping HTTP headers from an HTTP response?
2009-12-15 21:50 ` Tim X
@ 2009-12-16 7:31 ` Klaus Straubinger
0 siblings, 0 replies; 5+ messages in thread
From: Klaus Straubinger @ 2009-12-16 7:31 UTC (permalink / raw
To: help-gnu-emacs
Tim X <timx@nospam.dev.null> wrote:
> Another place to get some ideas would be the sources to emacs w3.
And there we find
| (defun w3-download-callback (fname)
| (let ((coding-system-for-write 'binary))
| (goto-char (point-min))
| (search-forward "\n\n" nil t)
| (write-region (point) (point-max) fname))
| (url-mark-buffer-as-dead (current-buffer))
| (message "Download of %s complete." (url-view-url t))
| (sit-for 3))
The simple solution to search for the first empty line seemed to be
good enough.
--
Klaus Straubinger
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-12-16 7:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-15 13:28 Stripping HTTP headers from an HTTP response? Elena
2009-12-15 14:44 ` Klaus Straubinger
2009-12-15 15:34 ` Elena
2009-12-15 21:50 ` Tim X
2009-12-16 7:31 ` Klaus Straubinger
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.