Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BROWSER:
- {
- "args": {},
- "headers": {
- "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
- "Accept-Encoding": "gzip, deflate, br",
- "Accept-Language": "en-US,en;q=0.5",
- "Dnt": "1",
- "Host": "httpbin.org",
- "Referer": "https://www.reddit.com/",
- "Sec-Fetch-Dest": "document",
- "Sec-Fetch-Mode": "navigate",
- "Sec-Fetch-Site": "cross-site",
- "Sec-Fetch-User": "?1",
- "Sec-Gpc": "1",
- "Upgrade-Insecure-Requests": "1",
- "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0",
- "X-Amzn-Trace-Id": "private"
- },
- "origin": "ip address",
- "url": "https://httpbin.org/get"
- }
- LIBCPR:
- CODE:
- #include <cpr/cpr.h>
- #include <iostream>
- int main() {
- cpr::Header headers = {{"User-Agent","Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/117.0"}};
- cpr::Response response = cpr::Get(cpr::Url{"https://httpbin.org/get"},headers);
- std::cout << response.text << "\n";
- }
- RESULT:
- {
- "args": {},
- "headers": {
- "Accept": "*/*",
- "Accept-Encoding": "deflate, gzip, br, zstd",
- "Host": "httpbin.org",
- "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/117.0",
- "X-Amzn-Trace-Id": "private"
- },
- "origin": "ip",
- "url": "https://httpbin.org/get"
- }
- REQWEST:
- CODE:
- fn main() -> Result<(), reqwest::Error> {
- let client = reqwest::blocking::Client::builder()
- .user_agent("Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/117.0")
- .cookie_store(true)
- .build().unwrap();
- let res = client
- .get("https://httpbin.org/get")
- .header("Accept-Encoding", "deflate, gzip, br, zstd")
- .send()
- .unwrap();
- println!("Status code: {}", res.status());
- println!("{:?}", res.text());
- Ok(())
- }
- RESULT:
- {
- "args": {},
- "headers": {
- "Accept": "*/*",
- "Accept-Encoding": "deflate, gzip, br, zstd",
- "Host": "httpbin.org",
- "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/117.0",
- "X-Amzn-Trace-Id": "private"
- },
- "origin": "ip",
- "url": "https://httpbin.org/get"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement