Jump to content

PHP API for the WebUI


Miyanokouji

Recommended Posts

  • 1 year later...
  • Replies 62
  • Created
  • Last Reply
  • 3 weeks later...
  • 1 month later...
  • 7 months later...

hey Ultima, I have a problem with your tweaked script.

I copied your script without any changes and when I try to make it login or doing any other actions

I always get this error 'could not get token'.

I made sure of course that the auth_token is enabled.

Do you have any idea why it happens?

Edit:

Oh, oops i fix that problem. But now there's a strange problem..

When the auth_token is enabled when I try to use the 'getTorrents' function i get this error:

Warning: Invalid argument supplied for foreach() in...

But when I set the webui.token_auth to FALSE, it works fine.

This is how I call to this function:

$torrents = $torrent->getTorrents();

it's not getting a thing.

Unless of course I'm using this function not the way it should be used.

After I'm doing this:

$torrents = $torrent->getTorrents();

I'm running a foreach like that:

foreach($torrents as $torrent1) {
echo $torrent1[UTORRENT_TORRENT_NAME] . "<br>";
}

Is that's how it should be?

Another Edit:

I understand that there is now a new method of verifications. Used by cookies, right?

Is there a way to implement it in this script?

Link to comment
Share on other sites

Perhaps cookies are indeed screwing things up. I'm not familiar enough with PHP/curl to be able to say how much effort it'd be, but I doubt it would be too bad, assuming curl allows you to get/set the connection's cookie details. The only thing that would need to be done is for the cookie to also be stored alongside the token when the token is being retrieved, and then have the library attach that cookie to every request it sends.

Link to comment
Share on other sites

Perhaps cookies are indeed screwing things up. I'm not familiar enough with PHP/curl to be able to say how much effort it'd be, but I doubt it would be too bad, assuming curl allows you to get/set the connection's cookie details. The only thing that would need to be done is for the cookie to also be stored alongside the token when the token is being retrieved, and then have the library attach that cookie to every request it sends.

Oh, I see.

Question is, on what base this cookie get it's value?

Need to know what value to set for this cookie for it to work.

Yeah, seems like pain in the ass ;)

Link to comment
Share on other sites

As I said, you get the cookie from the connection when you retrieve the token. µTorrent will give you a cookie; all you need to do is send that back on every request after.

Yes, but...

I checked that. When i use that PHP class for example to gain access to the webui using cURL,

and after i removed the cookie it created back then, it won't create it again when it's using cURL

(If I understood right from your message).

Link to comment
Share on other sites

  • 1 year later...

Not sure if anyone still uses this or not but I figured I'd let you know I've made some improvements and added some functionality to this library.

https://github.com/tboothman/utorrent-php-api

For whatever reason a cookie is needed as well as the token when used remotely so I've added in the code to support that.

I've added in RSS filter functionality which lets you retrieve, update and add new filters.

Added composer support, because .. it's awesome.

I assume no-one else is maintaining this code? Couldn't find it elsewhere on github and this seems to be the last reference to it.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...