Я хочу показать свою проблему и надеюсь найти решение У меня есть этот сайт для создания учетных записей IPTV http://iptv.alkaicerteams.com/iptv/index.php Этот сайт содержит несколько паролей, которые случайным образом обмениваются по короткой ссылке выше. Пароль подтверждаетсякороткая ссылка
Затем сайт отправляет пароль по следующей ссылке для создания учетной записи http://iptv.alkaicerteams.com/iptv/post.php И он попросил руководителя
POST /iptv/post.php HTTP/1.1
Host: iptv.alkaicerteams.com
Connection: keep-alive
Content-Length: 21
Accept: */*
Origin: http://iptv.alkaicerteams.com
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36
DNT: 1
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Referer: http://iptv.alkaicerteams.com/iptv/index.php
Accept-Encoding: gzip, deflate
Accept-Language: ar,en-US;q=0.9,en;q=0.8
Cookie: PHPSESSID=q4l3hp1h2cvm1amvaq69uund96
user=1120135520184221
Ответ будет
HTTP/1.1 200 OK
Date: Sat, 15 Dec 2018 03:22:47 GMT
Server: Apache/2.4.7 (Ubuntu)
X-Powered-By: PHP/5.5.9-1ubuntu4.26
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
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 89
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html
{"status":"success","username":"Kaicer_J7klnKAP","password":"4qu17iCzKC"}
Вы ввели код, который идентифицирует короткую ссылку и идентифицирует пароль http://iptv.alkaicerteams.com/iptv/index.php И затем отправьте данные на http://iptv.alkaicerteams.com/iptv/post.php Но ответ приходит
POST /iptv/post.php HTTP/1.0
Host: iptv.alkaicerteams.com
Connection: close
Content-Length: 21
Content-type: application/x-www-form-urlencoded
user=2224248965317031
HTTP/1.1 200 OK
Date: Sat, 15 Dec 2018 03:28:44 GMT
Server: Apache/2.4.7 (Ubuntu)
X-Powered-By: PHP/5.5.9-1ubuntu4.26
Set-Cookie: PHPSESSID=9h8hvbfriusnhn7lcf3ns00g85; path=/
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
Content-Length: 38
Connection: close
Content-Type: application/json; charset=UTF-8
{"status":"error","message":"invalid"}
В чем проблема с моим кодом
<?php
$curl_handle=curl_init();
curl_setopt($curl_handle, CURLOPT_URL,'http://iptv.alkaicerteams.com/iptv/index.php');
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
$query = curl_exec($curl_handle);
curl_close($curl_handle);
$lines = explode("\n", $query);
$shotline= $lines[257];
$shotline = preg_replace('/\s+/', '', $shotline);
preg_match('/(http:\/\/[^\s]+)/', $shotline, $text);
$solit_shor_url =($text[0]);
$end_short_url = substr($solit_shor_url, 0, 19);
$pass ='';
if ($end_short_url=='http://gsul.me/e4uM') {
$pass ='user=2224248965317031';
} else if ($end_short_url=='http://gsul.me/e4uT') {
$pass ='user=1120135520184221';
}
else if ($end_short_url=='http://gsul.me/e4uX') {
$pass ='user=9999600017456111';
}
else if ($end_short_url=='http://gsul.me/e4v0') {
$pass ='user=9441513141365431';
}
else if ($end_short_url=='http://gsul.me/e4un') {
$pass ='user=3354872122101111';
}
else if ($end_short_url=='http://gsul.me/e4uw') {
$pass ='user=798460044567891';
}
else if ($end_short_url=='http://gsul.me/e4us') {
$pass ='user=7513000478963541';
}
else if ($end_short_url=='http://gsul.me/e4vc') {
$pass ='user=4242421596324581';
}
else if ($end_short_url=='http://gsul.me/e4uo') {
$pass ='user=7531596542584301';
}
else if ($end_short_url=='http://gsul.me/e4uG') {
$pass ='user=5303306289156271';
}
else {
$pass ='erorr';
}
//echo 'url: '.$end_short_url ;
//echo 'pass: '.$pass ;
$url = 'http://iptv.alkaicerteams.com/iptv/post.php';
//$ID = $_GET['id'];
//pass = http://iptv.alkaicerteams.com/iptv/
$data = $pass ;
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
"Origin: http://iptv.alkaicerteams.com",
'method' => 'POST',
'content' => $data,
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
//$XX= $json_a['username'];
echo $result ;