clientID = $clientName; $this->plexProduct = $productName; } private function getPins() { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, "https://plex.tv/api/v2/pins"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $headers = array("Content-Type: application/x-www-form-urlencoded", "accept: application/json"); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); $data = "strong=true&X-Plex-Product=" . $this->plexProduct . "&X-Plex-Client-Identifier=" . $this->clientID; curl_setopt($curl, CURLOPT_POSTFIELDS, $data); $resp = curl_exec($curl); $returnCode = curl_getinfo($curl, CURLINFO_RESPONSE_CODE); curl_close($curl); if($returnCode != 201) return false; return $resp; } public function getURL(){ $pinJSON = $this->getPins(); if(!$pinJSON){ return false; } $parsedPinJSON = json_decode($pinJSON,true); $this->id = parsedPinJSON["id"]; $this->code = parsedPinJSON["code"]; } } ?>