How to use the RapidShare API to get account information?

When I try to use the RapidShare API to get account information, I get a long string, for example:

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 a value accountidfor a variable? For example $username = VALUE OF ACCOUNTID? I tried strpos, but I could not get it to work.

+1
source share
1 answer

If it's just a simple 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 a little different if it were a query string , which might be likely.

+2
source

Source: https://habr.com/ru/post/1725847/


All Articles