Hello forum colleagues, I have an issue with a code that scrapes the URL of one of those video hosting websites that use m3u8 files. Despite being able to obtain the link, this link is subject to the user agent IP and the origin, or perhaps also the referer. Could you please help me understand how I can create a reverse proxy request to play the video on a JW Player?
Below is my attempt at a reverse proxy using curl:
```php
private function curl()
{
// Reverse Proxy
$this->ipClient = $_SERVER['REMOTE_ADDR'];
$this->userAgent = $_SERVER['HTTP_USER_AGENT'];
$this->origin = $_SERVER['HTTP_ORIGIN'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"X-forwarded-for: $this->ipClient",
"User-Agent: $this->userAgent",
"origin: $this->origin",
"referer: https://fembed.cc",
"sec-fetch-dest: iframe",
"sec-fetch-mode: navigate",
"sec-fetch-site: cross-site",
"sec-fetch-user: ?1"
));
}
```
Below is my attempt at a reverse proxy using curl:
```php
private function curl()
{
// Reverse Proxy
$this->ipClient = $_SERVER['REMOTE_ADDR'];
$this->userAgent = $_SERVER['HTTP_USER_AGENT'];
$this->origin = $_SERVER['HTTP_ORIGIN'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"X-forwarded-for: $this->ipClient",
"User-Agent: $this->userAgent",
"origin: $this->origin",
"referer: https://fembed.cc",
"sec-fetch-dest: iframe",
"sec-fetch-mode: navigate",
"sec-fetch-site: cross-site",
"sec-fetch-user: ?1"
));
}
```