HTTPS: Difference between revisions
m
→{{header|Wren}}: Minor tidy
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
m (→{{header|Wren}}: Minor tidy) |
||
(9 intermediate revisions by 5 users not shown) | |||
Line 122:
<syntaxhighlight lang="d">
import std.stdio;
import std.net.curl;
auto data = get("https://sourceforge.net");
writeln(data);
Line 234 ⟶ 236:
=={{header|Frink}}==
<syntaxhighlight lang="frink">print[read["https://sourceforge.net/"]]</syntaxhighlight>
=={{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}}==
Line 351 ⟶ 381:
=={{header|JavaScript}}==
=== Browser ===
Using fetch API and async/await:
<syntaxhighlight lang="javascript">
const text = await response.text();
console.log(text);
</syntaxhighlight>
<syntaxhighlight lang="javascript">fetch("https://sourceforge.net").then(function (response) {
return response.text();
Line 356 ⟶ 395:
return body;
});</syntaxhighlight>
=== Node.js ===
<syntaxhighlight lang="javascript">require("https").get("https://sourceforge.net", function (resp) {
Line 647 ⟶ 687:
=={{header|PowerShell}}==
<syntaxhighlight lang="powershell">
Invoke-WebRequest 'https://www.rosettacode.org'
</syntaxhighlight>
<syntaxhighlight lang="powershell">
$wc = New-Object Net.WebClient
Line 816 ⟶ 860:
=={{header|Sidef}}==
<syntaxhighlight lang="ruby">
require('LWP::Protocol::https')
▲var url = 'https://rosettacode.org';
func get(url) {
static ua = %O<LWP::UserAgent>.new(
ssl_opts => Hash
)
if (resp.is_success) {
return resp.decoded_content
}
}
say get("https://rosettacode.org")</syntaxhighlight>
▲var resp = ua.get(url);
▲resp.is_success || die "Failed to GET #{url.dump}: #{resp.status_line}";
=={{header|Swift}}==
Line 945 ⟶ 994:
{{libheader|libcurl}}
An embedded program so we can ask the C host to communicate with libcurl for us.
<syntaxhighlight lang="
var CURLOPT_URL = 10002
Line 978 ⟶ 1,027:
<br>
We now embed this in the following C program, compile and run it.
<syntaxhighlight lang="c">/* gcc
#include <stdio.h>
Line 1,088 ⟶ 1,137:
WrenVM* vm = wrenNewVM(&config);
const char* module = "main";
const char* fileName = "
char *script = readFile(fileName);
WrenInterpretResult result = wrenInterpret(vm, module, script);
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}}
|