<?php
//http://www.eksperten.dk/spm/765100
$username = 'username';
$password = 'password';
$host = '
www.nike.com';$port_login = 443;
$port_data = 80;
$request_login = '/nikeplus/v1/services/widget/generate_pin.jhtml?login='.$username.'&password='.$password.'&locale=en_us';
$request_data = '/nikeplus/v1/services/app/get_user_data.jhtml';
$fp = pfsockopen("
ssl://" . $host, $port_login, $errno, $errstr);
if($fp)
{
$out = "GET ".$request_login." HTTP/1.1\r\n";
$out .= "Host: ".$host."\r\n";
$out .= "Connection: close\r\n\r\n";
fwrite($fp, $out);
while(!feof($fp))
{
$output_login .= fgets($fp, 128);
}
fclose($fp);
if(preg_match('/BSESSIONID=(.+?);/', $output_login, $match))
{
$fp = pfsockopen($host, $port_data, $errno, $errstr);
if($fp)
{
$out = "GET ".$request_data." HTTP/1.1\r\n";
$out .= "Host: ".$host."\r\n";
$out .= "Cookie: BSESSIONID=".$match[1]."\r\n";
$out .= "Connection: close\r\n\r\n";
fwrite($fp, $out);
while(!feof($fp))
{
$output_data .= fgets($fp, 128);
}
fclose($fp);
header("Content-Type: text/xml");
echo substr($output_data,strpos($output_data,"\r\n\r\n")+4);
//echo $output_data;
}
}
}
?>
Giver data som en XML fil.