Last active
December 25, 2023 09:09
-
-
Save codenoid/3edc9c048206cf7fb2ce90216e3e025a to your computer and use it in GitHub Desktop.
Revisions
-
codenoid revised this gist
Dec 19, 2019 . No changes.There are no files selected for viewing
-
codenoid revised this gist
Dec 19, 2019 . 2 changed files with 46 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ var request = require('request'); var headers = { 'User-Agent': 'Chrome/62.0 (BSD x86_64; rv:71.0) Gecko/20100101 Firefox/71.0', 'Accept': '*/*', 'Accept-Language': 'en-US,en;q=0.5', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'X-Requested-With': 'XMLHttpRequest', 'Origin': 'https://s.id', 'Connection': 'keep-alive', 'Referer': 'https://s.id/' }; var dataString = 'url=https%3A%2F%2Fne.com'; var options = { url: 'https://s.id/api/public/link/shorten', method: 'POST', headers: headers, body: dataString }; function callback(error, response, body) { if (!error && response.statusCode == 200) { console.log(body); } } request(options, callback); This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ <?php include('vendor/rmccue/requests/library/Requests.php'); Requests::register_autoloader(); $headers = array( 'User-Agent' => 'Chrome/62.0 (BSD x86_64; rv:71.0) Gecko/20100101 Firefox/71.0', 'Accept' => '*/*', 'Accept-Language' => 'en-US,en;q=0.5', 'Content-Type' => 'application/x-www-form-urlencoded; charset=UTF-8', 'X-Requested-With' => 'XMLHttpRequest', 'Origin' => 'https://s.id', 'Connection' => 'keep-alive', 'Referer' => 'https://s.id/' ); $data = array( 'url' => 'https://ne.com' ); $response = Requests::post('https://s.id/api/public/link/shorten', $headers, $data); -
codenoid revised this gist
Dec 19, 2019 . 3 changed files with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,7 @@ void main() async { 'Accept-Encoding': 'gzip', }; var data = 'url=https%3A%2F%2Fne.com'; var res = await http.post('https://s.id/api/public/link/shorten', headers: headers, body: data); if (res.statusCode != 200) throw Exception('post error: statusCode= ${res.statusCode}'); This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import ( func main() { client := &http.Client{} var data = []byte(`{url=https%3A%2F%2Fne.com}`) req, err := http.NewRequest("POST", "https://s.id/api/public/link/shorten", data) if err != nil { log.Fatal(err) This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -15,7 +15,7 @@ fn main() -> Result<(), reqwest::Error> { let res = reqwest::Client::new() .post("https://s.id/api/public/link/shorten") .headers(headers) .body("url=https%3A%2F%2Fne.com") .send()? .text()?; println!("{}", res); -
codenoid created this gist
Dec 19, 2019 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ curl 'https://s.id/api/public/link/shorten' -H 'User-Agent: Chrome/62.0 (BSD x86_64; rv:71.0) Gecko/20100101 Firefox/71.0' -H 'Accept: */*' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'X-Requested-With: XMLHttpRequest' -H 'Origin: https://s.id' -H 'Connection: keep-alive' -H 'Referer: https://s.id/' --data 'url=https%3A%2F%2Fne.com' This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ import 'package:http/http.dart' as http; void main() async { var headers = { 'User-Agent': 'Chrome/62.0 (BSD x86_64; rv:71.0) Gecko/20100101 Firefox/71.0', 'Accept': '*/*', 'Accept-Language': 'en-US,en;q=0.5', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'X-Requested-With': 'XMLHttpRequest', 'Origin': 'https://s.id', 'Connection': 'keep-alive', 'Referer': 'https://s.id/', 'Accept-Encoding': 'gzip', }; var data = 'url=https%3A%2F%2Fne.coma'; var res = await http.post('https://s.id/api/public/link/shorten', headers: headers, body: data); if (res.statusCode != 200) throw Exception('post error: statusCode= ${res.statusCode}'); print(res.body); } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ package main import ( "fmt" "io/ioutil" "log" "net/http" ) func main() { client := &http.Client{} var data = []byte(`{url=https%3A%2F%2Fne.coma}`) req, err := http.NewRequest("POST", "https://s.id/api/public/link/shorten", data) if err != nil { log.Fatal(err) } req.Header.Set("User-Agent", "Chrome/62.0 (BSD x86_64; rv:71.0) Gecko/20100101 Firefox/71.0") req.Header.Set("Accept", "*/*") req.Header.Set("Accept-Language", "en-US,en;q=0.5") req.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8") req.Header.Set("X-Requested-With", "XMLHttpRequest") req.Header.Set("Origin", "https://s.id") req.Header.Set("Connection", "keep-alive") req.Header.Set("Referer", "https://s.id/") resp, err := client.Do(req) if err != nil { log.Fatal(err) } bodyText, err := ioutil.ReadAll(resp.Body) if err != nil { log.Fatal(err) } fmt.Printf("%s\n", bodyText) } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ import requests headers = { 'User-Agent': 'Chrome/62.0 (BSD x86_64; rv:71.0) Gecko/20100101 Firefox/71.0', 'Accept': '*/*', 'Accept-Language': 'en-US,en;q=0.5', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'X-Requested-With': 'XMLHttpRequest', 'Origin': 'https://s.id', 'Connection': 'keep-alive', 'Referer': 'https://s.id/', } data = { 'url': 'https://ne.com' } response = requests.post('https://s.id/api/public/link/shorten', headers=headers, data=data) This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ extern crate reqwest; use reqwest::headers::*; fn main() -> Result<(), reqwest::Error> { let mut headers = HeaderMap::new(); headers.insert(USER_AGENT, "Chrome/62.0 (BSD x86_64; rv:71.0) Gecko/20100101 Firefox/71.0".parse().unwrap()); headers.insert(ACCEPT, "*/*".parse().unwrap()); headers.insert(ACCEPT_LANGUAGE, "en-US,en;q=0.5".parse().unwrap()); headers.insert(CONTENT_TYPE, "application/x-www-form-urlencoded; charset=UTF-8".parse().unwrap()); headers.insert(X_REQUESTED_WITH, "XMLHttpRequest".parse().unwrap()); headers.insert(ORIGIN, "https://s.id".parse().unwrap()); headers.insert(CONNECTION, "keep-alive".parse().unwrap()); headers.insert(REFERER, "https://s.id/".parse().unwrap()); let res = reqwest::Client::new() .post("https://s.id/api/public/link/shorten") .headers(headers) .body("url=https%3A%2F%2Fne.coma") .send()? .text()?; println!("{}", res); Ok(()) }