diff --git a/_function.php b/_function.php index 59e57ab..f668983 100644 --- a/_function.php +++ b/_function.php @@ -30,9 +30,9 @@ } $data = curl_exec($ch); - curl_close($ch); - if ($curl_errno > 0) + if (curl_errno($ch)) $this->ErrorEcho(14, 'Connect Error!!!'); + curl_close($ch); return ($data) ? $data : false; } public function FileRead($filename=NULL) diff --git a/mangalist.php b/mangalist.php index bd0a4fc..17629dc 100644 --- a/mangalist.php +++ b/mangalist.php @@ -2,7 +2,7 @@ include_once '_function.php'; $marumaru = new Marumaru(); $file = $marumaru->FileRead('mangalist.txt'); - if(!$file || explode(PHP_EOL, $file)[0] < time()) + if(!isset($file) || @explode(PHP_EOL, $file)[0] < time()) { $data = $marumaru->WEBParsing('http://marumaru.in/c/1'); $a = explode('" href="/b/manga/', $data); @@ -14,7 +14,10 @@ $c[] = ['href'=>'/b/manga/'.$id, 'title'=>$name, 'id'=>$id]; } $marumaru->FileWrite(json_encode(array('list'=>$c)), 'mangalist.txt'); - $file = $marumaru->FileRead('mangalist.txt'); + //$file = $marumaru->FileRead('mangalist.txt'); + $file = json_encode(array('list'=>$c)); + echo $file; + exit; } echo explode(PHP_EOL, $file)[1]; exit; \ No newline at end of file