PHP Curl Get Request with Parameters Example
This simple article demonstrates of php curl get request with parameters example. This article goes in detailed on php curl get request example. it's simple example of php curl get request with params. it's simple example of curl get request php example. Let's get started with curl http request php.
In this tutorial, i will give you very simple example of how to send get curl request with parameters in php. so, let's see bellow example with output:
Example:
<?php
$ch = curl_init();
$url = "https://api.mywebtuts.com/api/users";
$dataArray = ['page' => 2];
$data = http_build_query($dataArray);
$getUrl = $url."?".$data;
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_URL, $getUrl);
curl_setopt($ch, CURLOPT_TIMEOUT, 80);
$response = curl_exec($ch);
if(curl_error($ch)){
echo 'Request Error:' . curl_error($ch);
}else{
echo $response;
}
curl_close($ch);
?>
Output:
i hope it can help you...
Hardik Savani
I'm a full-stack developer, entrepreneur and owner of ItSolutionstuff.com. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.
We are Recommending you
- Angular 12 CRUD Application Tutorial Example
- Angular 12 Httpclient Service Request Example
- Laravel Sanctum SPA API Authentication Example
- Laravel 8 REST API with Passport Authentication Tutorial
- Laravel 8 Import Export Excel and CSV File Tutorial
- Laravel 8 Auth with Livewire Jetstream Tutorial
- Codeigniter Curl Post Request with Parameters Example
- PHP CURL Post Request with Parameters Example
- Laravel Block/Whitelist IP Address Tutorial
- Laravel CURL Request Example using Ixudra/curl
- Laravel 5.2 API using JWT authentication tutorial from scratch example
- PHP Download File from URL using CURL Request Example