If the API cannot connect to a web server, it's currently unable to catch the error and it tries to display an image of the page anyway. The isURLReachable function's curl_exec will return false if it can't connect so we can use that to tell the user that domain is wrong or the server is down.
This patch also includes modified error images and the paths to the images reference the local filesystem rather than referencing the project demo page.
If the API cannot connect to a web server, it's currently unable to catch the error and it tries to display an image of the page anyway. The isURLReachable function's curl_exec will return false if it can't connect so we can use that to tell the user that domain is wrong or the server is down.
This patch also includes modified error images and the paths to the images reference the local filesystem rather than referencing the project demo page.
Examples of the current stable release: https://dev1.http2pic.nerds.io/stable/api.php?url=http://foobar.nerds.io (domain that doesn't exist so curl_exec fails because there's no web server to query) https://dev1.http2pic.nerds.io/stable/api.php?url=http://nerds.io/foobar (page not found but web server responds with a status code so an error image is displayed)
Examples with patch: https://dev1.http2pic.nerds.io/dev/api.php?url=http://foobar.nerds.io (domain not found, failed to connect image displayed. Also responds with HTTP/1.0 404 status code) https://dev1.http2pic.nerds.io/dev/api.php?url=http://nerds.io/foobar (page not found, error image displayed. Also responds with HTTP/1.0 404 status code)
The patch is available for testing at https://dev1.http2pic.nerds.io/dev/