Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set timeout for get_meta_tags() & get_headers()

I've been using the get_meta_tags() & get_headers() PHP functions, and need to set a timeout value in case the website is slow or unresponsive. Does anyone know how to do it?

like image 240
rob Avatar asked May 18 '11 20:05

rob


1 Answers

You should be able to influence this (as it's via URL wrappers) with the default_socket_timeout ini setting.

Try either setting it in the php.ini file or by doing something like

ini_set('default_socket_timeout', 10);

to set a 10 sec timeout (the default value is 60)

like image 105
James C Avatar answered Sep 20 '22 21:09

James C