Im trying to open an api and extract some data and about 1/5 times the script runs it errors with a
PHP Warning: file_get_contents(http://192.168.1.52/home.cgi): failed to open stream: HTTP request failed! 1
I would like to retry opening the api on error and then follow through with the rest of the code
This is running on a Pi using PHP5
$inverterDataURL = "http://".$dataManagerIP."/home.cgi";
$context = stream_context_create(array('http'=>array('protocol_version'=>'1.1')));
$result = file_get_contents('http://192.168.1.11/home.cgi', false, $context);
20% of the time when running the script it errors trying to open the api and without the api being open i can't grab any data out of it. the rest of the script runs through fine when it opens correctly