File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<!DOCTYPE html>
2- < html >
3- < head >
4-
5- </ head >
6- < body >
7- < p > Hello, World!</ p >
8- </ body >
9-
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6+ < title > PHP Proxy Example</ title >
7+ </ head >
8+ < body >
9+ < h1 > PHP Proxy Example</ h1 >
10+
11+ < ?php
12+ // The URL you want to fetch content from
13+ $url = 'https://api.example.com/data';
14+
15+ // Initialize a cURL session
16+ $ch = curl_init();
17+
18+ // Set the URL
19+ curl_setopt($ch, CURLOPT_URL, $url);
20+ // Return the transfer as a string
21+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
22+
23+ // Execute the cURL session
24+ $output = curl_exec($ch);
25+
26+ // Close the cURL session
27+ curl_close($ch);
28+
29+ // Output the content
30+ if ($output === FALSE) {
31+ echo "cURL Error: " . curl_error($ch);
32+ } else {
33+ echo $output;
34+ }
35+ ?>
36+ </ body >
1037</ html >
You can’t perform that action at this time.
0 commit comments