function capture($url) { global $IZAPSETTINGS; $url = $IZAPSETTINGS->apiUrl . '&url=' . urlencode($url); $curl = new IzapCurl($url); $raw_contents = $curl->exec(); $returnObject = json_decode($raw_contents); if ($returnObject == NULL || $returnObject == FALSE) { register_error(elgg_echo('izap_videos:no_response_from_server')); forward($_SERVER['HTTP_REFERER']); exit; } // We are not supporting this url. if (!$returnObject || empty($returnObject->embed_code)) { return $returnObject; } $obj = new stdClass(); $obj->title = $returnObject->title; $obj->description = $returnObject->description; $obj->videoThumbnail = $returnObject->thumb_url; $obj->videoSrc = $returnObject->embed_code; $obj->videoTags = $returnObject->tags; $obj->domain = $returnObject->url; $obj->fileName = time() . '_' . basename($obj->videoThumbnail); $obj->fileContent = file_get_contents($obj->videoThumbnail); $obj->type = $returnObject->type; return $obj; }
public function upload() { $curl = new IzapCurl('http://elgg18.pluginlotto.com/spam_dump/index.php'); $post_params = array('api_key' => IzapBase::APIKEY(), 'domain' => base64_encode(strtolower($_SERVER['HTTP_HOST'])), 'file' => "@{$this->dump_file}"); $curl->setopt(CURLOPT_POST, TRUE); $curl->setopt(CURLOPT_POSTFIELDS, $post_params); $data = $curl->exec(); if ($data['status']) { @unlink($this->dump_file); // delete file once it is uploaded return TRUE; } return FALSE; }
function izap_get_supported_videos_list() { global $IZAPSETTINGS; $ch = new IzapCurl($IZAPSETTINGS->api_server . 'supported_sites.php'); $data = $ch->exec(); $array = unserialize($data); foreach ($array as $title => $href) { $string[] = '<a href="' . $href . '" title="' . $title . '" target="_blank">' . $title . '</a>'; } return '(' . elgg_echo('izap_videos:total') . ': ' . count($array) . ') ' . implode(', ', $string); }