# Getting Started with CURL

## What is CURL

> **curl** is a command used to send a request to a website from the terminal.  
> It helps us see the website response without using a browser.  
> We use it to test APIs and check if a site is working.
> 
> ```plaintext
> C:\Users\ranja> curl https://wttr.in
> ```
> 
> When you will run this command on your terminal you will be getting Weather
> 
> output :———
> 
> ```plaintext
> Security Warning: Script Execution Risk
> Invoke-WebRequest parses the content of the web page. Script code in the web page might be run when the page is
> parsed.
>       RECOMMENDED ACTION:
>       Use the -UseBasicParsing switch to avoid script code execution.
> 
>       Do you want to continue?
> 
> [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): y
> 
> 
> StatusCode        : 200
> StatusDescription : OK
> Content           : Weather report: New Delhi, India
> 
>                                     Haze
>                        _ - _ - _ -  19 °C
>                         _ - _ - _   ↖ 4 km/h
> 
> awContent        : HTTP/1.1 200 OK
>                     Access-Control-Allow-Origin: *
>                     Content-Length: 8722
>                     Content-Type: text/plain; charset=utf-8
>                     Date: Sat, 31 Jan 2026 12:37:36 GMT
> 
>                     Weather report: New Delhi, India
> 
>                                    ...
> Forms             : {}
> Headers           : {[Access-Control-Allow-Origin, *], [Content-Length, 8722], [Content-Type, text/plain;
>                     charset=utf-8], [Date, Sat, 31 Jan 2026 12:37:36 GMT]}
> Images            : {}
> InputFields       : {}
> Links             : {}
> ParsedHtml        : mshtml.HTMLDocumentClass
> RawContentLength  : 8722
> ```

## Why programmers need CURL

> Programmer need CURL because of Through Curl we can directly talk to websites and APIs from the terminal
> 
> if a server is working and what response it gives.
> 
> Through this we can directly Excess data

## Making your first request using curl

> ```plaintext
> curl https://api.github.com/users/yourusername
> ```
> 
> Output :———-
> 
> ```plaintext
>  C:\Users\ranja> curl https://api.github.com/users/01Ranjan
> 
> Security Warning: Script Execution Risk
> Invoke-WebRequest parses the content of the web page. Script code in the web page might be run when the page is
> parsed.
>       RECOMMENDED ACTION:
>       Use the -UseBasicParsing switch to avoid script code execution.
> 
>       Do you want to continue?
> 
> [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): y
> 
> 
> StatusCode        : 200
> StatusDescription : OK
> Content           : {"login":"01Ranjan","id":174847980,"node_id":"U_kgDOCmv37A","avatar_url":"https://avatars.githubuse
>                     rcontent.com/u/174847980?v=4","gravatar_id":"","url":"https://api.github.com/users/01Ranjan","html_
>                     ur...
> RawContent        : HTTP/1.1 200 OK
>                     Vary: Accept,Accept-Encoding, Accept, X-Requested-With
>                     X-GitHub-Media-Type: github.v3; format=json
>                     x-github-api-version-selected: 2022-11-28
>                     Access-Control-Expose-Headers: ETag, Li...
> Forms             : {}
> Headers           : {[Vary, Accept,Accept-Encoding, Accept, X-Requested-With], [X-GitHub-Media-Type, github.v3;
>                     format=json], [x-github-api-version-selected, 2022-11-28], [Access-Control-Expose-Headers, ETag,
>                     Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining,
>                     X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes,
>                     X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id,
>                     Deprecation, Sunset]...}
> Images            : {}
> InputFields       : {}
> Links             : {}
> ParsedHtml        : mshtml.HTMLDocumentClass
> RawContentLength  : 1184
> ```

**Summary**

> This article provides an overview of the curl command, a useful tool for sending requests to websites and APIs directly from the terminal. It explains how curl can be used to test site responses and validate server functionality without a browser. The article includes examples of using curl to retrieve weather information and user data from GitHub, while highlighting security considerations when executing scripts in the terminal.
