fetch last articles
This commit is contained in:
parent
a52134a256
commit
e75e3c069c
6 changed files with 267 additions and 5 deletions
|
@ -18,6 +18,11 @@ function urlIsAvailable($url){
|
|||
}
|
||||
|
||||
function getImage($url){
|
||||
$alternativeurl = "./hellowrld/".str_replace("/","-",$url);
|
||||
if(file_exists($alternativeurl)){
|
||||
header('Content-Type: '.mime_content_type($alternativeurl));
|
||||
die(file_get_contents($alternativeurl));
|
||||
}
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
|
@ -25,7 +30,6 @@ function getImage($url){
|
|||
curl_setopt($ch,CURLOPT_TIMEOUT_MS,2000);
|
||||
$response = curl_exec($ch);
|
||||
$res = !(curl_errno($ch) or curl_getinfo($ch, CURLINFO_HTTP_CODE)!==200);
|
||||
$alternativeurl = "./hellowrld/".str_replace("/","-",$url);
|
||||
if($res){
|
||||
/* $f = file_get_contents("alldomains");
|
||||
if(!str_contains($f,$url)){
|
||||
|
@ -35,10 +39,6 @@ function getImage($url){
|
|||
header('Content-Type: '.curl_getinfo($ch, CURLINFO_CONTENT_TYPE));
|
||||
die($response);
|
||||
}
|
||||
elseif(file_exists($alternativeurl)){
|
||||
header('Content-Type: '.mime_content_type($alternativeurl));
|
||||
die(file_get_contents($alternativeurl));
|
||||
}
|
||||
else{
|
||||
header('Content-Type: image/png');
|
||||
die(file_get_contents(/*"https://media4.giphy.com/media/kFgzrTt798d2w/giphy.gif?cid=6c09b952ydxjfsstihmewt3scg3w3cqtseu7k3n08tjto20n&ep=v1_gifs_search&rid=giphy.gif&ct=g"));//*/"./assets/images/logo.png"));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue