-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
anytizer
committed
Sep 10, 2019
1 parent
642a753
commit efc89a7
Showing
11 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://hookb.in/xxxxxxxxxxxxxx"); | ||
|
||
httpWebRequest.ContentType = "application/json"; | ||
httpWebRequest.Method = "POST"; | ||
|
||
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream())) | ||
{ | ||
string json = "{\"name\":\"John\"}"; | ||
|
||
streamWriter.Write(json); | ||
streamWriter.Flush(); | ||
streamWriter.Close(); | ||
} | ||
|
||
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse(); | ||
|
||
using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) | ||
{ | ||
var result = streamReader.ReadToEnd(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
curl -X POST -H "Content-Type: application/json" -d '{"name": "John"}' https://hookb.in/xxxxxxxxxxxxxx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
jsonStr := []byte(`{"name": "John"}`) | ||
|
||
req, err := http.NewRequest("POST", "https://hookb.in/xxxxxxxxxxxxxx", bytes.NewBuffer(jsonStr)) | ||
req.Header.Set("Content-Type", "application/json") | ||
|
||
client := &http.Client{} | ||
|
||
resp, err := client.Do(req) | ||
|
||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
defer resp.Body.Close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
$.ajax({ | ||
type: "POST", | ||
url: "https://hookb.in/xxxxxxxxxxxxxx", | ||
data: JSON.stringify({ | ||
"name": "John" | ||
}), | ||
dataType: "json", | ||
contentType: "application/json; charset=utf-8", | ||
success: function (data) { | ||
console.log("done."); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const https = require("https"); | ||
|
||
const data = JSON.stringify({ | ||
name: "John" | ||
}) | ||
|
||
const options = { | ||
hostname: "hookb.in", | ||
port: 443, | ||
path: "/xxxxxxxxxxxxxx", | ||
method: "POST", | ||
headers: { | ||
"Content-Type": "application/json", | ||
"Content-Length": data.length | ||
} | ||
} | ||
|
||
const req = https.request(options, (res) => { | ||
console.log(`status: ${res.statusCode}`); | ||
}); | ||
|
||
req.write(data); | ||
req.end(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
my $uri = 'https://hookb.in/xxxxxxxxxxxxxx'; | ||
my $req = HTTP::Request->new('POST', $uri); | ||
my $data = '{"name": "John"}'; | ||
|
||
$req->header('Content-Type' => 'application/json'); | ||
$req->content($data); | ||
|
||
my $lwp = LWP::UserAgent->new; | ||
$lwp->request($req); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
$handle = curl_init('https://hookb.in/xxxxxxxxxxxxxx'); | ||
|
||
$data = [ | ||
'name' => 'John' | ||
]; | ||
|
||
$encodedData = json_encode($data); | ||
|
||
curl_setopt($handle, CURLOPT_POST, 1); | ||
curl_setopt($handle, CURLOPT_POSTFIELDS, $encodedData); | ||
curl_setopt($handle, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); | ||
|
||
$result = curl_exec($handle); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import requests | ||
|
||
url = 'https://hookb.in/xxxxxxxxxxxxxx' | ||
|
||
data = { | ||
"name": "John" | ||
} | ||
|
||
r = requests.post(url, verify=False, json=data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Examples copied from hook bin. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
uri = URI('https://hookb.in/xxxxxxxxxxxxxx') | ||
|
||
req = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json') | ||
|
||
req.body = { | ||
name: 'John' | ||
}.to_json | ||
|
||
res = Net::HTTP.start(uri.hostname, uri.port) do |http| | ||
http.request(req) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
var xhr = new XMLHttpRequest(); | ||
|
||
xhr.open("POST", "https://hookb.in/xxxxxxxxxxxxxx", true); | ||
xhr.setRequestHeader("Content-Type", "application/json"); | ||
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); | ||
|
||
xhr.onreadystatechange = function () { | ||
if (xhr.readyState === 4 && xhr.status === 200) { | ||
console.log("done."); | ||
} | ||
}; | ||
|
||
var data = JSON.stringify({ | ||
"name": "John" | ||
}); | ||
|
||
xhr.send(data); |