Skip to content

Instantly share code, notes, and snippets.

@nobodyplace
Last active July 16, 2019 09:00
Show Gist options
  • Select an option

  • Save nobodyplace/169adae10570870deb1456820dce23c6 to your computer and use it in GitHub Desktop.

Select an option

Save nobodyplace/169adae10570870deb1456820dce23c6 to your computer and use it in GitHub Desktop.
<?php
$client = new \GuzzleHttp\Client([
'cookies' => true
,'http_errors' => false
]);
$client->post('https://secure.nicovideo.jp/secure/login',[
'form_params' => [
'mail' => $mail,
'password' => $password
]
]);
$response = $client->get('https://seiga.nicovideo.jp/api/user/data',[
'query' => ['id' => 10908584]
]);
echo $response->getBody(); //NULL
<?php
$jar = new \GuzzleHttp\Cookie\CookieJar();
$client = new \GuzzleHttp\Client([
'cookies' => true
,'http_errors' => false
]);
$client->post('https://secure.nicovideo.jp/secure/login',[
'cookies' => $jar,
'form_params' => [
'mail' => $mail,
'password' => $password
]
]);
$response = $client->get('https://seiga.nicovideo.jp/api/user/data',[
'cookies' => $jar,
'query' => ['id' => 10908584]
]);
echo $response->getBody();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment