<?php

namespace amJL_class;

class CheckStatus {
    private int $status_code = -1;
    private bool $isError = false;

    public function __construct($input_url) {
        $time_out = array('timeout' => '5');
        $response = wp_remote_get($input_url, $time_out);
        $this->status_code = (int)wp_remote_retrieve_response_code($response);
        $this->isError = is_wp_error($response);
    }

    public function check_url_status(){
        if (!$this->isError && $this->status_code < 400 && $this->status_code >= 200)  return true;
        else    return false;
    }

}
