Advertisement
dereksir

Untitled

Mar 15th, 2024 (edited)
683
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.85 KB | None | 0 0
  1. using System;
  2. using System.Net.Http;
  3.  
  4. namespace TestApplication {
  5.     class Test {
  6.         static async Task Main(string[] args) {
  7.             string apiUrl = "https://api.zenrows.com/v1/?apikey=<YOUR_ZENROWS_API_KEY>&url=https%3A%2F%2Fwww.g2.com%2Fproducts%2Fasana%2Freviews&js_render=true&premium_proxy=true";
  8.            
  9.             using (HttpClient client = new HttpClient()) {
  10.                 HttpResponseMessage response = await client.GetAsync(apiUrl);
  11.                
  12.                 if (response.IsSuccessStatusCode) {
  13.                     string content = await response.Content.ReadAsStringAsync();
  14.                     Console.WriteLine(content);
  15.                 }
  16.                 else {
  17.                     Console.WriteLine($"Failed to retrieve data. Status code: {response.StatusCode}");
  18.                 }
  19.             }
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement