key = SLIDESHARE_KEY; $this->secret = SLIDESHARE_SECRET; $this->apiurl = 'https://www.slideshare.net/api/2'; } public function get_slideshow($url) { $ts = time(); $hash = sha1($this->secret.$ts); $request_url = $this->apiurl."/get_slideshow?api_key={$this->key}&ts={$ts}&hash={$hash}&slideshow_url={$url}&detailed=1"; $ch = curl_init($request_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); $data = curl_exec($ch); $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($httpcode == 200) { $xml = new SimpleXMLElement($data); $json = json_decode(json_encode($xml)); if (isset($json->ID)) { return $json; } return false; } return false; } }