Answer the question
In order to leave comments, you need to log in
Why is curl_exec not outputting data?
header('Content-type: text/html; charset=utf-8');
require 'phpQuery/phpQuery.php';
function debug($arr) {
echo '<pre>'. print_r($arr, true). '</pre>';
}
function getContent($url, $data = []) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_COOKIEJAR, __DIR__ . '/cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, __DIR__ . '/cookie.txt');
$res = curl_exec($ch);
curl_close($ch);
return $res;
}
$urlAuth = 'https://auth.mail.ru/cgi-bin/auth';
$url = 'https://wf.mail.ru/officers';
$auth_data = [
'Page' => 'https://wf.mail.ru/',
'FakeAuthPage' => 'https://wf.mail.ru/auth',
'Login' => 'МоеМыло',
'Password' => 'мойПароль',
'do_login' => ''
];
$data = getContent($urlAuth, $auth_data);
$data = getContent($url);
debug($data);
Answer the question
In order to leave comments, you need to log in
are you fooling people? the fact that the link https://wf.mail.ru/officers/ is available from the browser does not mean that it works via api. See here how to work with api
https://wf.mail.ru/wiki/index.php/API#.D0.9E.D0.BF...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question