I have a problem in my code and I want your help I have this site that makes an IPTV account
This site depends on three pages before it can be downloaded On the second page "http://thgss.com/index.php?p=download2" and after entering the captcha code.
POST request is sent to 'http://thgss.com/index.php?p=download3'
With the following data : 'done=true&submit=Download+Now'
request header
POST /index.php?p=download3 HTTP/1.1
Host: thgss.com
Connection: keep-alive
Content-Length: 29
Cache-Control: max-age=0
Origin: http://thgss.com
Upgrade-Insecure-Requests: 1
DNT: 1
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Referer: http://thgss.com/index.php?p=download2
Accept-Encoding: gzip, deflate
Accept-Language: ar,en-US;q=0.9,en;q=0.8
Cookie: PHPSESSID=imbdp791tqal3fq8ifa80till1
done=true&submit=Download+Now
The m3u file link is in the reply header in location
HTTP/1.1 302 Found
Date: Tue, 18 Dec 2018 04:56:17 GMT
Server: Apache/2.4.7 (Ubuntu)
X-Powered-By: PHP/5.5.9-1ubuntu4.24
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
location: http://24.thgss.com:8000/get.php?username=37441545108977&password=37441545108977&type=m3u&output=mpegts
Content-Length: 2584
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html
My code works well on the local server
But when you upload it to remote server show"bool(false)" error
I want you to help me check my code
my code
function getUserIP() {
if( array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR']) ) {
if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',')>0) {
$addr = explode(",",$_SERVER['HTTP_X_FORWARDED_FOR']);
return trim($addr[0]);
} else {
return $_SERVER['HTTP_X_FORWARDED_FOR'];
}
}
else {
return $_SERVER['REMOTE_ADDR'];
}
}
$ip = getUserIP() ;
$data = 'done=true&submit=Download+Now';
$headers = array(
$data,
'Content-Type: application/x-www-form-urlencoded',
'Referer: http://thgss.com/index.php?p=download2',
'X-Forwarded-For: '. $ip
);
$curl_handle=curl_init();
curl_setopt($curl_handle, CURLOPT_URL,'http://thgss.com/index.php?p=download3');
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_HEADER, 1);
curl_setopt($curl_handle,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36');
curl_setopt($curl_handle, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($curl_handle);
curl_close($curl_handle);
var_dump($response);