How to use RapidShare API to get Account Details?

扶醉桌前 提交于 2020-01-06 03:36:10

问题


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 ...

How can I get values from it using PHP?

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.


回答1:


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.



来源:https://stackoverflow.com/questions/1094889/how-to-use-rapidshare-api-to-get-account-details

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!