如何使用RapidShare API获取帐户详细信息? [英] How to use RapidShare API to get Account Details?

查看:117
本文介绍了如何使用RapidShare API获取帐户详细信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用RapidShare API获取帐户详细信息时,我得到了一个长字符串,如下所示:

When I try to use the RapidShare API to get account details, I get a long string like this:

accountid=******* type=prem servertime=1247000294 addtime=********** validuntil=********* username=*****8 directstart=1 protectfiles=0 ...

如何使用PHP从中获取价值?

How can I get values from it using PHP?

更具体地说,如何将accountid的值设置为变量?例如$username = VALUE OF ACCOUNTID?我尝试了strpos,但无法正常工作.

To be more specific, how can I set the value of accountid to a variable? For instance $username = VALUE OF ACCOUNTID? I tried strpos, but I couldn't get it to work.

推荐答案

如果只是纯字符串,如您发布的内容...

If it's just a plain string like what you posted...

    $url = "accountid=*** type=prem servertime=1247000294 addtime=****** validuntil=**** username=8 directstart=1 protectfiles=0";

    $temp = explode(' ', $url);
    foreach($temp as $k => $v)
    {
        $temp[$k] = explode('=', $v);
        $data[$temp[$k][0]] = $temp[$k][1];
    }
    unset($temp);

    $data["accountid"] // stores the account ID, equal to "***"
    $data["type"]      // stores the type, equal to "prem"
    //etc....

如果它实际上是一个查询字符串,则可能会略有不同.

It would be slightly different if it was actually a query string, which could be likely.

这篇关于如何使用RapidShare API获取帐户详细信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆