file_get_contents function
<?php
$content = file_get_contents('https://httpbin.org/get');
echo $content;
cURL extension
- Enable extension in
php.ini
file:
extension=curl
- Send GET request:
<?php
$ch = curl_init('https://httpbin.org/get');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$content = curl_exec($ch);
curl_close($ch);
echo $content;
Leave a Comment
Cancel reply