use GuzzleHttp\Client;
$jar = new \GuzzleHttp\Cookie\CookieJar();$base_headers = ['Accept-Encoding' => 'gzip, deflate, br', 'Cache-Control' => 'no-cache', 'Accept' => '*/*'];$client = new \GuzzleHttp\Client(array( 'verify' => false, 'cookies' => $jar, 'base_uri' => 'https://tmp.org', 'headers' => $base_headers, 'decode_content' => false, 'allow_redirects' => false));
$res1 = $client->post('pkmslogin.form', ['form_params' => ['login-form-type' => 'pwd', 'username' => 'testuser', 'password' => 'testpass']]);$res2 = $client->head('ESS/rp/0713/ESS', []);$res3 = $client->post('ESS/data/ess/services/TnA.asmx/GetUpcomingShifts?siteName=ess&siteId=1001134', ['decode_content' => true], '{}');echo $res3->getBody();--
You received this message because you are subscribed to the Google Groups "Guzzle - PHP HTTP client and REST client framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guzzle+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<?php
$jar = new \GuzzleHttp\Cookie\CookieJar();$client = new \GuzzleHttp\Client(array( 'verify' => false, 'cookies' => $jar, 'base_uri' => 'https://tmp.org', //'handler' => $stack, 'headers' => ['Accept-Encoding' => 'gzip'], 'decode_content' => false, 'stream' => true));
$res1 = $client->post('pkmslogin.form', ['form_params' => ['login-form-type' => 'pwd', 'username' => 'tmpuser', 'password' => 'tmppass']]);$res2 = $client->get('ESS/rp/0713/ESS', []);$res3 = $client->post('ESS/data/ess/services/TnA.asmx/GetUpcomingShifts?siteName=ess&siteId=1001134', ['decode_content' => true, 'stream' => false], '{}');echo $res3->getBody();
?><?php
$jar = new \GuzzleHttp\Cookie\CookieJar();$client = new \GuzzleHttp\Client(array( 'verify' => false, 'cookies' => $jar, 'base_uri' => 'https://oasis-sso.tmp.org', 'headers' => ['Accept-Encoding' => 'gzip'], 'decode_content' => false));echo '::1send::' . round(microtime(true) * 1000);$client->post('pkmslogin.form', ['form_params' => ['login-form-type' => 'pwd', 'username' => 'tmpuser', 'password' => 'tmppass'], 'on_headers' => function (\Psr\Http\Message\ResponseInterface $res1) { global $client, $jar; extractCookies($res1, '.tmp.org', $jar); $client->get('ESS/rp/0713/ESS', ['on_headers' => function (\Psr\Http\Message\ResponseInterface $res2) { global $client, $jar; extractCookies($res2, '.publix.org', $jar); $res3 = $client->post('ESS/data/ess/services/TnA.asmx/GetUpcomingShifts?siteName=ess&siteId=1001134', ['decode_content' => true], '{}'); echo $res3->getBody(); }]);}]);
function extractCookies($response, $host, $jar) { if ($cookieHeader = $response->getHeader('Set-Cookie')) { foreach ($cookieHeader as $cookie) { $sc = GuzzleHttp\Cookie\SetCookie::fromString($cookie); if (!$sc->getDomain()) { $sc->setDomain($host); } $jar->setCookie($sc); } }}?>--
You received this message because you are subscribed to the Google Groups "Guzzle - PHP HTTP client and REST client framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guzzle+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.