|
|
|
@ -35,6 +35,19 @@ function ellipse($str,$n_chars,$crop_str=' [...]')
|
|
|
|
|
return $buff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function download($url, $outFile) {
|
|
|
|
|
$options = array(
|
|
|
|
|
CURLOPT_FILE => fopen($outFile, 'w'),
|
|
|
|
|
CURLOPT_TIMEOUT => 28800, // set this to 8 hours so we dont timeout on big files
|
|
|
|
|
CURLOPT_URL => $url
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$ch = curl_init();
|
|
|
|
|
curl_setopt_array($ch, $options);
|
|
|
|
|
curl_exec($ch);
|
|
|
|
|
curl_close($ch);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$string = get_text('https://ifhub.club/rss/new/');
|
|
|
|
|
$service = new \Sabre\Xml\Service();
|
|
|
|
|
$service->elementMap = [
|
|
|
|
@ -98,10 +111,12 @@ foreach ($articles as $article) {
|
|
|
|
|
$mdescription .= ": $link";
|
|
|
|
|
/*
|
|
|
|
|
if ($image) {
|
|
|
|
|
download('https://ifhub.club'.$image, './'.basename($image));
|
|
|
|
|
$attachment = $mastodon->post('/media', [
|
|
|
|
|
'file' => $image
|
|
|
|
|
'file' => file_get_contents('./'.basename($image))
|
|
|
|
|
]);
|
|
|
|
|
var_dump($attachment);
|
|
|
|
|
unlink('./'.basename($image));
|
|
|
|
|
$mdescription .= $attachment->url;
|
|
|
|
|
}*/
|
|
|
|
|
$mastodon->status_post($mdescription);
|
|
|
|
|