HTTPS: Difference between revisions

4,023 bytes added ,  5 months ago
m
m (→‎{{header|Phix}}: added syntax colouring, marked p2js incompatible)
m (→‎{{header|Wren}}: Minor tidy)
 
(10 intermediate revisions by 6 users not shown)
Line 9:
{{libheader|AWS}}
Exactly the same as the HTTP task, assuming you compiled AWS with openssl support.
<langsyntaxhighlight lang="ada">
with AWS.Client;
with AWS.Response;
Line 18:
URL => "https://sourceforge.net/")));
end GetHttps;
</syntaxhighlight>
</lang>
 
=={{header|Arturo}}==
 
<langsyntaxhighlight lang="rebol">print read "https://www.w3.org/"</langsyntaxhighlight>
 
=={{header|AutoHotkey}}==
{{libheader|wininet}}
<syntaxhighlight lang="autohotkey">
<lang AutoHotkey>
URL := "https://sourceforge.net/"
WININET_Init()
Line 34:
#include urlgetcontents.ahk
#include wininet.ahk
</syntaxhighlight>
</lang>
 
=={{header|BaCon}}==
This code requires BaCon 3.8.2 or later.
<langsyntaxhighlight lang="freebasic">OPTION TLS TRUE
website$ = "www.google.com"
 
Line 53:
 
PRINT REPLACE$(total$, "\r\n[0-9a-fA-F]+\r\n", "\r\n", TRUE) : ' Remove chunk indicators from HTML data
</syntaxhighlight>
</lang>
 
=={{header|Batch File}}==
<langsyntaxhighlight lang="batch">
:: Must have curl.exe
curl.exe -k -s -L https://sourceforge.net/
</syntaxhighlight>
</lang>
 
=={{header|C}}==
{{libheader|libcurl}}
<langsyntaxhighlight lang="c">#include <stdio.h>
#include <stdlib.h>
#include <curl/curl.h>
Line 80:
}
return EXIT_SUCCESS;
}</langsyntaxhighlight>
 
=={{header|C sharp|C#}}==
{{works with|C sharp|3.0}}
 
<langsyntaxhighlight lang="csharp">
using System;
using System.Net;
Line 99:
}
}
</syntaxhighlight>
</lang>
 
This does not work for urls requiring a secure (SSL) connection.
Line 106:
Using the duck-streams as a convenient wrapper for Java's networking classes, grabbing the contents of an HTTPS URL is as easy as:
 
<langsyntaxhighlight lang="clojure">
(use '[clojure.contrib.duck-streams :only (slurp*)])
(print (slurp* "https://sourceforge.net"))
</syntaxhighlight>
</lang>
 
The usual Java mechanisms can be used to manage acceptance of SSL certificates if required.
 
{{works with|Clojure|1.2}}
<langsyntaxhighlight lang="clojure">
(print (slurp "https://sourceforge.net"))
</syntaxhighlight>
</lang>
 
=={{header|D}}==
Using curl
 
<syntaxhighlight lang="d">
<lang d>
import std.stdio;
import std.net.curl;
auto data = get("https://sourceforge.net");
writeln(data);
</syntaxhighlight>
</lang>
 
=={{header|Common Lisp}}==
Line 131 ⟶ 133:
First grabbing the entire body as a string, and then by pulling from a stream. This is the same code as in [[HTTP Request]]; <code>drakma:http-request</code> supports SSL.
 
<langsyntaxhighlight lang="lisp">
(defun wget-drakma-string (url &optional (out *standard-output*))
"Grab the body as a string, and write it to out."
Line 145 ⟶ 147:
;; Use
(wget-drakma-stream "https://sourceforge.net")
</syntaxhighlight>
</lang>
 
{{libheader|Dexador}}
 
<langsyntaxhighlight lang="lisp">
(format t "~a~%" (nth-value 0 (dex:get "https://www.w3.org/")))
</syntaxhighlight>
</lang>
 
=={{header|Delphi}}==
{{libheader|OpenSSL}}
<syntaxhighlight lang="delphi">
<lang Delphi>
program ShowHTTPS;
 
Line 176 ⟶ 178:
end;
end.
</syntaxhighlight>
</lang>
 
=={{header|EchoLisp}}==
'''file->string''' usage: the server must allow cross-domain access, or a browser add-on like cors-everywhere must be installed to bypass cross-domain checking.
<langsyntaxhighlight lang="scheme">
;; asynchronous call back definition
(define (success name text) (writeln 'Loaded name) (writeln text))
;;
(file->string success "https:/sourceforge.net")
</syntaxhighlight>
</lang>
 
=={{header|Erlang}}==
===Synchronous===
<langsyntaxhighlight lang="erlang">
-module(main).
-export([main/1]).
Line 200 ⟶ 202:
{error, Res} -> io:fwrite("~p~n", [Res])
end.
</syntaxhighlight>
</lang>
 
===Asynchronous===
<langsyntaxhighlight lang="erlang">
-module(main).
-export([main/1]).
Line 216 ⟶ 218:
after 10000 -> io:fwrite("Timed out.~n",[])
end.
</syntaxhighlight>
</lang>
 
Using it
<langsyntaxhighlight lang="erlang">
|escript ./req.erl https://sourceforge.net/
</syntaxhighlight>
</lang>
 
=={{header|F_Sharp|F#}}==
The underlying .NET classes handle secure web connections the same way they manage insecure connections.
<langsyntaxhighlight lang="fsharp">
#light
let wget (url : string) =
let c = new System.Net.WebClient()
c.DownloadString(url)
</syntaxhighlight>
</lang>
 
=={{header|Frink}}==
<langsyntaxhighlight Frinklang="frink">print[read["https://sourceforge.net/"]]</langsyntaxhighlight>
 
=={{header|FutureBasic}}==
<syntaxhighlight lang="futurebasic">
include "NSLog.incl"
 
local fn GET_HTTPS
CFStringRef response = unix @"curl -ksL https://sourceforge.net/"
CFDataRef dta = fn StringData( response, NSUTF8StringEncoding )
CFDictionaryRef options = @{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute: @(NSUTF8StringEncoding)}
CFAttributedStringRef aStr = fn AttributedStringWithHTML( dta, options )
NSLog( @"%@", aStr )
end fn
 
fn GET_HTTPS
 
HandleEvents
</syntaxhighlight>
{{output}}
<pre>
We're sorry -- the Sourceforge site is currently in Disaster Recovery mode. Please check back later. {
NSColor = "sRGB IEC61966-2.1 colorspace 0 0 0 1";
NSFont = "\"Times-Roman 12.00 pt. P [] (0x7f8f94e11ce0) fobj=0x7f8f94e0fda0, spc=3.00\"";
NSKern = 0;
NSParagraphStyle = "Alignment 4, LineSpacing 0, ParagraphSpacing 0, ParagraphSpacingBefore 0, HeadIndent 0, TailIndent 0, FirstLineHeadIndent 0, LineHeight 0/0, LineHeightMultiple 0, LineBreakMode 0, Tabs (\n), DefaultTabInterval 36, Blocks (\n), Lists (\n), BaseWritingDirection 0, HyphenationFactor 0, TighteningForTruncation YES, HeaderLevel 0 LineBreakStrategy 0";
NSStrokeColor = "sRGB IEC61966-2.1 colorspace 0 0 0 1";
NSStrokeWidth = 0;
}
</pre>
 
=={{header|Go}}==
<syntaxhighlight lang="go">
<lang go>
package main
 
Line 253 ⟶ 283:
io.Copy(os.Stdout, r.Body)
}
</syntaxhighlight>
</lang>
 
=={{header|Groovy}}==
<langsyntaxhighlight lang="groovy">
new URL("https://sourceforge.net").eachLine { println it }
</syntaxhighlight>
</lang>
 
=={{header|Haskell}}==
Line 266 ⟶ 296:
This is just the example from [http://hackage.haskell.org/packages/archive/http-conduit/1.8.5.1/doc/html/Network-HTTP-Conduit.html Network.HTTP.Conduit], with the http URL replaced with an https one, since [http://hackage.haskell.org/package/http-conduit http-conduit] natively supports https without needing any additional work.
 
<langsyntaxhighlight lang="haskell">#!/usr/bin/runhaskell
 
import Network.HTTP.Conduit
Line 273 ⟶ 303:
 
main = withSocketsDo
$ simpleHttp "https://sourceforge.net/" >>= L.putStr</langsyntaxhighlight>
 
==Icon and {{header|Unicon}}==
<langsyntaxhighlight lang="unicon"># Requires Unicon version 13
procedure main(arglist)
url := (\arglist[1] | "https://sourceforge.net/")
Line 282 ⟶ 312:
while write(read(w))
close(w)
end</langsyntaxhighlight>
 
{{out}}
Line 292 ⟶ 322:
=={{header|Ioke}}==
{{trans|Java}}
<langsyntaxhighlight lang="ioke">
connection = URL new("https://sourceforge.net") openConnection
scanner = Scanner new(connection getInputStream)
Line 299 ⟶ 329:
scanner next println
)
</syntaxhighlight>
</lang>
 
=={{header|J}}==
Using <tt>gethttp</tt> from [[Web Scraping#J|Web Scraping]]
 
<syntaxhighlight lang="j">
<lang j>
#page=: gethttp'https://sourceforge.net'
0
#page=: '--no-check-certificate' gethttp'https://sourceforge.net'
900
</syntaxhighlight>
</lang>
 
(We can not load the example page using https unless we disable certificate checking. The numbers are the number of characters retrieved.)
Line 316 ⟶ 346:
=== javax.net.ssl ===
Additional certificate information is available through the [http://java.sun.com/javase/6/docs/api/javax/net/ssl/HttpsURLConnection.html javax.net.ssl.HttpsURLConnection] interface.
<syntaxhighlight lang="java">
<lang Java>
URL url = new URL("https://sourceforge.net");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
Line 324 ⟶ 354:
System.out.println(scanner.next());
}
</syntaxhighlight>
</lang>
 
=== java.net.http ===
Using the standard [http://openjdk.java.net/groups/net/httpclient/ Java 11 HTTP Client]
 
<langsyntaxhighlight lang="java">import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
Line 347 ⟶ 377:
.join();
}
}</langsyntaxhighlight>
 
=={{header|JavaScript}}==
=== Browser ===
Using fetch API and async/await:
<lang JavaScript>fetch("https://sourceforge.net").then(function (response) {
<syntaxhighlight lang="javascript">
const response = await fetch('https://rosettacode.org');
const text = await response.text();
console.log(text);
</syntaxhighlight>
 
 
 
<syntaxhighlight lang="javascript">fetch("https://sourceforge.net").then(function (response) {
return response.text();
}).then(function (body) {
return body;
});</langsyntaxhighlight>
 
=== Node.js ===
<langsyntaxhighlight JavaScriptlang="javascript">require("https").get("https://sourceforge.net", function (resp) {
let body = "";
resp.on("data", function (chunk) {
Line 367 ⟶ 407:
}).on("error", function (err) {
console.error("Error: " + err.message);
});</langsyntaxhighlight>
 
=={{header|Julia}}==
<langsyntaxhighlight lang="julia"># v0.6.0
 
using Requests
 
str = readstring(get("https://sourceforge.net/"))</langsyntaxhighlight>
 
=={{header|Kotlin}}==
 
<langsyntaxhighlight lang="scala">// version 1.1.2
import java.net.URL
import javax.net.ssl.HttpsURLConnection
Line 391 ⟶ 431:
while (sc.hasNextLine()) println(sc.nextLine())
sc.close()
}</langsyntaxhighlight>
 
Or simplier, since Kotlin 1.2
<langsyntaxhighlight lang="scala">
import java.net.URL
 
Line 400 ⟶ 440:
println(URL("https://sourceforge.net").readText())
}
</syntaxhighlight>
</lang>
 
=={{header|Lasso}}==
<langsyntaxhighlight Lassolang="lasso">local(x = curl('https://sourceforge.net'))
local(y = #x->result)
#y->asString</langsyntaxhighlight>
 
If a site with an invalid SSL Cert is encountered the curl type throws the following error:
Line 415 ⟶ 455:
*Windows:
{{libheader|Curl Xtra}}
<langsyntaxhighlight lang="lingo">ch = xtra("Curl").new()
CURLOPT_URL = 10002
ch.setOption(CURLOPT_URL, "https://sourceforge.net")
Line 424 ⟶ 464:
put "Result:" && res.readRawString(res.length)
end if
-- "Result: <!doctype html> ..."</langsyntaxhighlight>
 
*Mac OS X:
{{libheader|Shell Xtra}}
<langsyntaxhighlight lang="lingo">sx = xtra("Shell").new()
put sx.shell_cmd("curl https://sourceforge.net")</langsyntaxhighlight>
 
=={{header|LiveCode}}==
Blocking version<langsyntaxhighlight LiveCodelang="livecode">libURLSetSSLVerification true --check cert
get URL "https://sourceforge.net/"</langsyntaxhighlight>
Non-blocking version, execute getWebResource
<langsyntaxhighlight LiveCodelang="livecode">on myUrlDownloadFinished
get URL "https://sourceforge.net/" -- this will now fetch a locally cached copy
put it
Line 444 ⟶ 484:
libURLSetSSLVerification true --check cert
load URL "https://sourceforge.net/" with message "myUrlDownloadFinished"
end getWebResource</langsyntaxhighlight>
 
=={{header|LSL}}==
Line 450 ⟶ 490:
 
To test it yourself; rez a box on the ground, and add the following as a New Script.
<langsyntaxhighlight LSLlang="lsl">string sURL = "https://SourceForge.Net/";
key kHttpRequestId;
default {
Line 469 ⟶ 509:
}
}
}</langsyntaxhighlight>
Output:
<pre>Status=200
Line 496 ⟶ 536:
{{works with|Lua|5.1 - 5.3}}
{{libheader|lua-http}}
<langsyntaxhighlight lang="lua">
local request = require('http.request')
local headers, stream = request.new_from_uri("https://sourceforge.net/"):go()
Line 502 ⟶ 542:
local status = headers:get(':status')
io.write(string.format('Status: %d\nBody: %s\n', status, body)
</syntaxhighlight>
</lang>
HTTPS requests can be also done with the much smaller libraries like [[LuaSec]] or [[lua-requests]], but it currently don't support redirects, which is why I used [[lua-http]] in this example.
 
=={{header|Maple}}==
<syntaxhighlight lang="maple">
<lang Maple>
content := URL:-Get( "https://www.google.ca/" );
</syntaxhighlight>
</lang>
 
=={{header|Mathematica}} / {{header|Wolfram Language}}==
Straight forward "Import" task. More complicated secure web access can be done using J/Link; essentially a link to Java API.
<syntaxhighlight lang="mathematica">
<lang Mathematica>
content=Import["https://sourceforge.net", "HTML"]
</syntaxhighlight>
</lang>
 
=={{header|MATLAB}} / {{header|Octave}}==
<langsyntaxhighlight MATLABlang="matlab">s=urlread('https://sourceforge.net/')</langsyntaxhighlight>
 
=={{header|Nemerle}}==
This example is essentially identical to the [[HTTP]] task because the <tt>WebClient</tt> object can be used with http:, https:, ftp: and file: uri's.
<langsyntaxhighlight Nemerlelang="nemerle">using System;
using System.Console;
using System.Net;
Line 537 ⟶ 577:
myStream.Close()
}
}</langsyntaxhighlight>
 
=={{header|NewLISP}}==
<langsyntaxhighlight lang="newlisp">(! "curl https://sourceforge.net")</langsyntaxhighlight>
 
=={{header|Nim}}==
{{libheader|OpenSSL}}
Compile with <code>nim c -d:ssl httpsClient.nim</code>:
<langsyntaxhighlight lang="nim">import httpclient
 
var client = newHttpClient()
echo client.getContent("https://sourceforge.net")</langsyntaxhighlight>
 
=={{header|Objeck}}==
<langsyntaxhighlight lang="objeck">
use HTTP;
 
Line 563 ⟶ 603:
}
}
</syntaxhighlight>
</lang>
 
=={{header|Ol}}==
{{libheader|libcurl}}
 
<langsyntaxhighlight lang="scheme">
(import (lib curl))
 
Line 574 ⟶ 614:
(curl 'url "https://www.w3.org/")
(curl 'perform)
</syntaxhighlight>
</lang>
 
=={{header|Pascal}}==
{{works with|Free Pascal}}
Using [http://wiki.freepascal.org/fphttpclient fphttpclient]
<langsyntaxhighlight lang="pascal">{$mode objfpc}{$H+}
uses fphttpclient;
 
Line 594 ⟶ 634:
end;
writeln(s)
end.</langsyntaxhighlight>
 
=={{header|Perl}}==
{{libheader|LWP}}
<langsyntaxhighlight lang="perl">
use strict;
use LWP::UserAgent;
Line 608 ⟶ 648:
 
print $response->as_string;
</syntaxhighlight>
</lang>
 
=={{header|Phix}}==
{{libheader|Phix/libcurl}}
Exactly the same as the [[HTTP#Phix]] task.
<!--<langsyntaxhighlight Phixlang="phix">(notonline)-->
<span style="color: #008080;">without</span> <span style="color: #008080;">js</span>
<span style="color: #008080;">include</span> <span style="color: #000000;">builtins</span><span style="color: #0000FF;">\</span><span style="color: #000000;">libcurl</span><span style="color: #0000FF;">.</span><span style="color: #000000;">e</span>
Line 624 ⟶ 664:
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">res</span><span style="color: #0000FF;">)</span>
<!--</langsyntaxhighlight>-->
 
=={{header|PHP}}==
<langsyntaxhighlight lang="php">
echo file_get_contents('https://sourceforge.net');
</syntaxhighlight>
</lang>
 
=={{header|PicoLisp}}==
PicoLisp has no functionality for communicating with a HTTPS server
(only for the other direction), but it is easy to use an external tool
<syntaxhighlight lang="picolisp">
<lang PicoLisp>
(in '(curl "https://sourceforge.net") # Open a pipe to 'curl'
(out NIL (echo)) ) # Echo to standard output
</syntaxhighlight>
</lang>
 
=={{header|Pike}}==
<langsyntaxhighlight lang="pike">
int main() {
write("%s\n", Protocols.HTTP.get_url_data("https://sourceforge.net"));
}
</syntaxhighlight>
</lang>
 
=={{header|PowerShell}}==
<langsyntaxhighlight lang="powershell">
Invoke-WebRequest 'https://www.rosettacode.org'
</syntaxhighlight>
 
<syntaxhighlight lang="powershell">
$wc = New-Object Net.WebClient
$wc.DownloadString('https://sourceforge.net')
</syntaxhighlight>
</lang>
 
If the certificate could not be validated (untrusted, self-signed, expired), then an Exception is thrown with the message ''“The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.”'' so certificate validation is done automatically by the method.
Line 656 ⟶ 700:
=={{header|Python}}==
Python's '''urllib.request''' library, has support for SSL if the interpreter's underlying ''httplib'' libraries were compiled with SSL support. By default this will be the enabled for default Python installations on most platforms.
<langsyntaxhighlight Pythonlang="python">import urllib.request
print(urllib.request.urlopen("https://sourceforge.net/").read())</langsyntaxhighlight>
 
=={{header|R}}==
Line 664 ⟶ 708:
 
The basic idea is to use getURL (as with [[HTTP_Request]]), but with some extra parameters.
<langsyntaxhighlight Rlang="r">library(RCurl)
webpage <- getURL("https://sourceforge.net/", .opts=list(followlocation=TRUE, ssl.verifyhost=FALSE, ssl.verifypeer=FALSE))</langsyntaxhighlight>
In this case, the webpage output contains unprocessed characters, e.g. \" instead of " and \\ instead of \, so we need to process the markup.
 
<syntaxhighlight lang="r">
<lang R>
wp <- readLines(tc <- textConnection(webpage))
close(tc)
</syntaxhighlight>
</lang>
 
Finally, we parse the HTML and find the interesting bit.
 
<syntaxhighlight lang="r">
<lang R>
pagetree <- htmlTreeParse(wp)
pagetree$children$html
</syntaxhighlight>
</lang>
 
=={{header|Racket}}==
<syntaxhighlight lang="racket">
<lang Racket>
#lang racket
(require net/url)
Line 687 ⟶ 731:
#:redirections 100)
(current-output-port))
</syntaxhighlight>
</lang>
 
=={{header|Raku}}==
Line 694 ⟶ 738:
There are several modules that provide HTTPS capability. WWW and HTTP::UserAgent are probably the most popular right now, but others exist.
 
<syntaxhighlight lang="raku" perl6line>use WWW;
say get 'https://sourceforge.net/';</langsyntaxhighlight>
or
<syntaxhighlight lang="raku" perl6line>use HTTP::UserAgent;
say HTTP::UserAgent.new.get('https://sourceforge.net/').content;</langsyntaxhighlight>
 
=={{header|REALbasic}}==
REALBasic provides an HTTPSecureSocket class for handling HTTPS connections. The 'Get' method of the HTTPSecureSocket is overloaded and can download data to a file or return data as a string, in both cases an optional timeout argument can be passed.
 
<syntaxhighlight lang="realbasic">
<lang REALbasic>
Dim sock As New HTTPSecureSocket
Print(sock.Get("https://sourceforge.net", 10)) //set the timeout period to 10 seconds.
</syntaxhighlight>
</lang>
 
=={{header|Ring}}==
<langsyntaxhighlight lang="ring">
cStr= download("http://sourceforge.net/")
see cStr + nl
</syntaxhighlight>
</lang>
 
=={{header|RLaB}}==
Line 720 ⟶ 764:
This solution doesn't use the <code>open-uri</code> convenience package that the [[HTTP Request#Ruby]] solution uses: the <code>Net::HTTP</code> object must be told to use SSL before the session is started.
 
<langsyntaxhighlight lang="ruby">
require 'net/https'
require 'uri'
Line 736 ⟶ 780:
puts content.body
end
</syntaxhighlight>
</lang>
 
outputs
Line 764 ⟶ 808:
 
=={{header|Rust}}==
<langsyntaxhighlight lang="rust">
extern crate reqwest;
 
Line 775 ⟶ 819:
println!("{}", response.text().unwrap());
}
</syntaxhighlight>
</lang>
{{out}}
<pre>
Line 793 ⟶ 837:
=={{header|Scala}}==
{{libheader|Scala}}
<langsyntaxhighlight lang="scala">import scala.io.Source
 
object HttpsTest extends App {
Line 799 ⟶ 843:
Source.fromURL("https://sourceforge.net").getLines.foreach(println)
}</langsyntaxhighlight>
 
=={{header|Seed7}}==
Line 806 ⟶ 850:
HTTPS protocol go get a file.
 
<langsyntaxhighlight lang="seed7">$ include "seed7_05.s7i";
include "gethttps.s7i";
include "utf8.s7i";
Line 813 ⟶ 857:
begin
writeln(STD_UTF8_OUT, getHttps("sourceforge.net"));
end func;</langsyntaxhighlight>
 
=={{header|Sidef}}==
<syntaxhighlight lang ="ruby">var lwp = require('LWP::UserAgent'); # LWP::Protocol::https is needed
require('LWP::Protocol::https')
var url = 'https://rosettacode.org';
 
func get(url) {
var ua = lwp.new(
static ua = %O<LWP::UserAgent>.new(
agent => 'Mozilla/5.0',
agent => 'Mozilla/5.0',
ssl_opts => Hash.new(verify_hostname => 1),
ssl_opts => Hash(verify_hostname => 1),
);
)
var resp = ua.get(url)
if (resp.is_success) {
return resp.decoded_content
}
die "Failed to GET #{url}: #{resp.status_line}"
}
 
say get("https://rosettacode.org")</syntaxhighlight>
var resp = ua.get(url);
resp.is_success || die "Failed to GET #{url.dump}: #{resp.status_line}";
print resp.decoded_content;</lang>
 
=={{header|Swift}}==
<langsyntaxhighlight Swiftlang="swift">import Foundation
 
// With https
Line 843 ⟶ 892:
}
 
CFRunLoopRun() // dispatch</langsyntaxhighlight>
 
=={{header|Tcl}}==
Though Tcl's built-in <code>http</code> package does not understand SSL, it does support the registration of external handlers to accommodate additional protocols. This allows the use of the [http://tls.sourceforge.net/ Tls] package to supply the missing functionality with only a single line to complete the registration.
 
<langsyntaxhighlight lang="tcl">
package require http
package require tls
Line 865 ⟶ 914:
puts [http::data $token]
http::cleanup $token
</syntaxhighlight>
</lang>
 
=={{header|TUSCRIPT}}==
<langsyntaxhighlight lang="tuscript">
$$ MODE TUSCRIPT
SET DATEN = REQUEST ("https://sourceforge.net")
*{daten}
</syntaxhighlight>
</lang>
 
=={{header|UNIX Shell}}==
<langsyntaxhighlight lang="bash">
curl -k -s -L https://sourceforge.net/
</syntaxhighlight>
</lang>
 
=={{header|VBScript}}==
Line 883 ⟶ 932:
 
Based on code at [http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/how-to-retrieve-html-web-pages-with-vbscript-via-the-microsoftxmlhttp-object/ How to retrieve HTML web pages with VBScript via the Microsoft.XmlHttp object]
<syntaxhighlight lang="vb">
<lang vb>
Option Explicit
 
Line 901 ⟶ 950:
 
Set oHTTP = Nothing
</syntaxhighlight>
</lang>
 
=={{header|Visual Basic}}==
Line 910 ⟶ 959:
{{works with|VBA|6.5}}
{{works with|VBA|7.1}}
<langsyntaxhighlight lang="vb">Sub Main()
Dim HttpReq As WinHttp.WinHttpRequest
' in the "references" dialog of the IDE, check
Line 930 ⟶ 979:
HttpReq.Send
Debug.Print HttpReq.ResponseText
End Sub</langsyntaxhighlight>
 
=={{header|Visual Basic .NET}}==
<langsyntaxhighlight lang="vbnet">
Imports System.Net
 
Line 939 ⟶ 988:
Dim content As String = client.DownloadString("https://sourceforge.net")
Console.WriteLine(content)
</syntaxhighlight>
</lang>
 
=={{header|Wren}}==
Line 945 ⟶ 994:
{{libheader|libcurl}}
An embedded program so we can ask the C host to communicate with libcurl for us.
<langsyntaxhighlight ecmascriptlang="wren">/* httpsHTTPS.wren */
 
var CURLOPT_URL = 10002
Line 975 ⟶ 1,024:
return
}
curl.easyCleanup()</langsyntaxhighlight>
<br>
We now embed this in the following C program, compile and run it.
<langsyntaxhighlight lang="c">/* gcc httpsHTTPS.c -o httpsHTTPS -lcurl -lwren -lm */
 
#include <stdio.h>
Line 1,088 ⟶ 1,137:
WrenVM* vm = wrenNewVM(&config);
const char* module = "main";
const char* fileName = "httpsHTTPS.wren";
char *script = readFile(fileName);
WrenInterpretResult result = wrenInterpret(vm, module, script);
Line 1,104 ⟶ 1,153:
free(script);
return 0;
}</langsyntaxhighlight>
 
=={{header|zkl}}==
Using the cURL library to do the heavy lifting:
<langsyntaxhighlight lang="zkl">zkl: var ZC=Import("zklCurl")
zkl: var data=ZC().get("https://sourceforge.net")
L(Data(36,265),826,0)</langsyntaxhighlight>
get returns the text of the response along with two counts: the bytes of header in front of the html code and the byte count of stuff after the end of the page. So, if you wanted to look at the header:
<pre>zkl: data[0][0,data[1]).text
Line 1,133 ⟶ 1,182:
{{omit from|Brainf***}}
{{omit from|Commodore BASIC|Does not have network access}}
{{omit from|EasyLang|Has no internet functions}}
{{omit from|Inform 7|Does not have network access.}}
{{omit from|Integer BASIC|No TCP/IP network support on Apple II}}
9,476

edits