From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.help Subject: Re: func return web url content Date: Wed, 11 May 2022 14:32:31 +0200 Message-ID: <87k0asz1sx.fsf@gnu.org> References: <87wnesl1sh.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="873"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.7.19; emacs 29.0.50 Cc: help-gnu-emacs@gnu.org To: Alex Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed May 11 14:35:42 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nolZ8-000AdS-N0 for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 11 May 2022 14:35:42 +0200 Original-Received: from localhost ([::1]:34296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nolZ7-00021u-LI for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 11 May 2022 08:35:41 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43522) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nolXA-0001zW-KO for help-gnu-emacs@gnu.org; Wed, 11 May 2022 08:33:40 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:38752) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nolX8-0002Nm-JX; Wed, 11 May 2022 08:33:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-reply-to:Date:Subject:To:From: References; bh=Es1yEcEgEx852wFZT9hMaz3G/f3BPeVIm+/+I7UDw2U=; b=Zqx6TIpiSAPM6p SVN8ewhrFPOVzisUZXu0nMYsKW2JXWBcFRfxlHUl8aL2Aj5n9u4TsnWdwOYksNwcH+BS/RmQm/C7I bKbX5HShdBLQZByU907qVUgw6us7QcZIu55YHLjo2kmM2UaJKpZUjsxz6cwrAQavrlTMDOIjpyGd7 DLT5tjLwPm/NGyork4PpFQrIvlYxh5Cq7Z0uVD2bu0MlVZnAfpp4CVkWT6da6EaM3Iv+JX1oOoew0 GTVTj9CaC/revAC4HlT8un7rw4uNF2DopS8eo4FbCqVczs15j/wCPX+fXIYeJ2cYYVLbXGjPkKVov nONZTjqT97yl8AaDbPXA==; Original-Received: from auth1-smtp.messagingengine.com ([66.111.4.227]:56705) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nolX7-0007aG-VS; Wed, 11 May 2022 08:33:38 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id 421A027C0054; Wed, 11 May 2022 08:33:37 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 11 May 2022 08:33:37 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrgeehgdehvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepfhgfhffvvefuffgjkfggtgesthdtre dttdertdenucfhrhhomhepvfgrshhsihhlohcujfhorhhnuceothhsughhsehgnhhurdho rhhgqeenucggtffrrghtthgvrhhnpeegkedttdehveetgfekffehvefhueetudelgedvge evueduhedvfffhieeftdevveenucffohhmrghinhepghhnuhdrtggrthenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhorhhnodhmvghsmh htphgruhhthhhpvghrshhonhgrlhhithihqdekieejfeekjeekgedqieefhedvleekqdht shguhheppehgnhhurdhorhhgsehfrghsthhmrghilhdrfhhm X-ME-Proxy: Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 11 May 2022 08:33:36 -0400 (EDT) In-reply-to: <87wnesl1sh.fsf@gnu.org> X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:137223 Archived-At: Alex writes: Hi Alex, > Hi, I need a function that return an url content. > > If GET request to https://gnu.cat/text/rxy.txt return "Hi" > > a func like: > > (defun wget-req (url) > (...)) > > (wget-req "https://gnu.cat/text/rxy.txt") => "Hi" This would do: (defun th/url-retrieve-contents (url) (with-current-buffer (url-retrieve-synchronously url) (goto-char (point-min)) (when (re-search-forward "\n\n" nil t) (buffer-substring (point) (point-max))))) (th/url-retrieve-contents "https://gnu.cat/text/rxy.txt") Bye, Tassilo