Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- define("PSN_AUTHORIZE","https://auth.api.sonyentertainmentnetwork.com/2.0/oauth/authorize?response_type=code&client_id=78420c74-1fdf-4575-b43f-eb94c7d770bf&redirect_uri=https%3a%2f%2fwww.bungie.net%2fen%2fUser%2fSignIn%2fPsnid&scope=psn:s2s&request_locale=en");
- define("PSN_LOGIN","https://auth.api.sonyentertainmentnetwork.com/login.do");
- function do_curl($url, $cookies = Array(), $post = Array(), $redirect = false)
- {
- $ch = curl_init($url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_HEADER, true);
- if( count($cookies) > 0 )
- {
- $sCookies = "";
- foreach($cookies AS $k => $v)
- {
- $sCookies .= $k."=".$v."&";
- }
- rtrim($sCookies,"&");
- curl_setopt($ch, CURLOPT_COOKIE, $sCookies);
- }
- if( count($post) > 0 )
- {
- $sPosts = "";
- foreach($post AS $k => $v)
- {
- $sPost .= $k."=".$v."&";
- }
- rtrim($sPost,"&");
- curl_setopt($ch, CURLOPT_POST, count($post));
- curl_setopt($ch, CURLOPT_POSTFIELDS, $sPost);
- }
- $result = curl_exec($ch);
- echo '<pre>result: '.$result.'</pre>';
- // get cookie
- preg_match('/^Set-Cookie:\s*([^;]*)/mi', $result, $m);
- parse_str($m[1], $cookies);
- if( $redirect )
- {
- return curl_getinfo($ch);
- }
- curl_close($ch);
- return $cookies;
- }
- $jsessionid = do_curl(PSN_AUTHORIZE)['JSESSIONID'];
- $njsessionid = do_curl(PSN_LOGIN, Array("JSESSIONID" => $jsessionid), Array("j_username" => urlencode("my@email.com"), "j_password" => urlencode("mypasswordissave")))['JSESSIONID'];
- $bungiesignin = do_curl(PSN_AUTHORIZE, Array("JSESSIONID" => $njsessionid), Array(), true);
- //var_dump($bungiesignin);
- ?>
- // OUTPUT:
- result: HTTP/1.1 302 Found
- Location: https://auth.api.sonyentertainmentnetwork.com/login.jsp?request_locale=en_US&request_theme=liquid
- Date: Mon, 09 Mar 2015 18:03:38 GMT
- Server: Apache
- P3P: CP="This site does not have a P3P policy."
- Content-Length: 0
- Content-Type: text/plain; charset=UTF-8
- Set-Cookie: JSESSIONID=BCB6F3CDD016E8E2674D310550A9A58B.lvp-p1-npversat26-4809; path=/; HttpOnly; secure
- result: HTTP/1.1 302 Found
- Location: https://auth.api.sonyentertainmentnetwork.com/loginSuccess.jsp
- Date: Mon, 09 Mar 2015 18:03:38 GMT
- Server: Apache
- Content-Length: 0
- Content-Type: text/plain; charset=UTF-8
- Set-Cookie: JSESSIONID=60EE588F3E946AC798B38D27A84EB1A4.lvp-p1-npversat05-4709; path=/; HttpOnly; secure
- result: HTTP/1.1 302 Found
- Location: https://auth.api.sonyentertainmentnetwork.com/login.jsp?request_locale=en_US&request_theme=liquid
- Date: Mon, 09 Mar 2015 18:03:39 GMT
- Server: Apache
- P3P: CP="This site does not have a P3P policy."
- Content-Length: 0
- Content-Type: text/plain; charset=UTF-8
- Set-Cookie: JSESSIONID=B55459F623A2AAE3110DFBFBCCE3C7D3.lvp-p1-npversat13-4809; path=/; HttpOnly; secure
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement