douyuan4825 2010-07-19 16:00
浏览 10

gamercards的API脚本

After hours and hours of searching I finally found an API script for gamercards. Only problem is this freaking thing updates every 30 minutes. If I open a new browser and go to the URL I get the most recent updated info. Is there a way to trick this thing to think each refresh is a new browser session?

http://xboxapi.duncanmackenzie.net/gamertag.ashx?GamerTag=gamerholics

Here's the script.

<?php
$ch = curl_init("http://xboxapi.duncanmackenzie.net/gamertag.ashx?GamerTag=gamerholics");

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 4);

$data = curl_exec($ch);
curl_close($ch);

$xml = new SimpleXmlElement($data, LIBXML_NOCDATA);

foreach ($xml->PresenceInfo as $mystatus) 
{
print  '<div id="xboxlivestatus"><a href="' . $xml->ProfileUrl . '">' . $xml->Gamertag . '</a> is ' . $mystatus->StatusText . ' : ' . $mystatus->Info . ' : ' . $mystatus->Info2. '</div>';
}

?>
  • 写回答

1条回答 默认 最新

  • duanmanmian7589 2010-07-19 23:18
    关注

    If your curl is storing cookies somewhere, then most likely it's keeping a cookie around that's giving you the 30 minute timeout. Try using

    curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE);
    

    to force session cookies (so they wipe after each run). As well, investigate if there's a cookie jar file somewhere, which you might have to wipe seperately to truly force a new session with the API each time.

    评论

报告相同问题?

悬赏问题

  • ¥15 stm32流水灯+呼吸灯+外部中断按键
  • ¥15 将二维数组,按照假设的规定,如0/1/0 == "4",把对应列位置写成一个字符并打印输出该字符
  • ¥15 NX MCD仿真与博途通讯不了啥情况
  • ¥15 win11家庭中文版安装docker遇到Hyper-V启用失败解决办法整理
  • ¥15 gradio的web端页面格式不对的问题
  • ¥15 求大家看看Nonce如何配置
  • ¥15 Matlab怎么求解含参的二重积分?
  • ¥15 苹果手机突然连不上wifi了?
  • ¥15 cgictest.cgi文件无法访问
  • ¥20 删除和修改功能无法调用