time - If function execute more than x seconds php -
in script use function:
function url_exists($url) { if ((strpos($url, "http")) === false) $url = "http://" . $url; if (is_array(@get_headers($url))) return true; else return false; }
how can set time limit of execute function @get_headers? need function set_time_limit() works 1 function, not whole script.
the function get_headers()
doesn't supports timeout or context param. try:
ini_set('default_socket_timeout', your_value_in_seconds);
this set default timeout value of choice. don't forget reset timeout after operation has finished.
Comments
Post a Comment