Просмотр исходного кода

Update getuTorrentToken to use PHPHtmlParser\Dom

As per Discord, issues with using php-dom which isn't included in the docker image. Switched to using the included PHPHtmlParser\Dom class instead
TehMuffinMoo 4 лет назад
Родитель
Сommit
6a97930f4e
1 измененных файлов с 5 добавлено и 5 удалено
  1. 5 5
      api/homepage/utorrent.php

+ 5 - 5
api/homepage/utorrent.php

@@ -117,11 +117,11 @@ trait uTorrentHomepageItem
 				$options = array_merge($options, $credentials);
 			}
 			$response = Requests::post($url, [], $data, $options);
-			$doc = new DOMDocument();
-			$doc->loadHTML($response->body);
-			$id = $doc->getElementById('token');
+			$dom = new PHPHtmlParser\Dom;
+			$dom->loadStr($response->body);
+			$id = $dom->getElementById('token')->text;
 			$uTorrentConfig = new stdClass();
-			$uTorrentConfig->uTorrentToken = $id->textContent;
+			$uTorrentConfig->uTorrentToken = $id;
 			$reflection = new ReflectionClass($response->cookies);
 			$cookie = $reflection->getProperty("cookies");
 			$cookie->setAccessible(true);
@@ -210,4 +210,4 @@ trait uTorrentHomepageItem
 	}
 	
 	
-}
+}