In the name of God
Hi there! I'm here to teach you how can you use cURL in PHP, but first we must know some words
![Ads (8)]()
1- What is the cURL
The PHP Client URL (cURL) is a useful extension for Back-End developers that allows developers that can connect they're website to other websites (Like REST APIs)
2- Prerequisites
Just an application like WAMPP, XAMPP, AMPPS etc and a PC (A Computer or Laptop)
3- How can I use cURL in PHP
At first, we must creating a session for our cURL and store it in a constant or variable
$curl = curl_init();
then, we can do everything with cURL!
when our works with cURL done, we must close session that we store that in a variable/constant
curl_close($curl);
curl_setopt(sessionName, option, value);
This is you and this is curl_setopt! Yeahhh! It's obvious from it's name that what it does for us!
curl_setopt will set options of cURL,
HTML Document Structure
Headings
Paragraphs
Links
Images
Lists
Tables
Forms
Input Types
Buttons
Div and Span
Comments
Semantic Elements
Meta Tags
Inline vs Block Elements
HTML Entities
Audio and Video
Iframe
Script and Style
HTML5 Doctype
First Parameter: Session name that we store it in variable/const
Second: Option name
curl_setopt(sessionName, option, value);
Third: value of option
like this code:
curl_setopt($curl, CURLOPT_URL, "https://c-sharpcorner.com);
This will set our target URL!
I think that it's enough for now! I will see you later, with better courses, articles and etc
I hope you enjoy! Good Bye!