pobject > pbookmark
methods
(bool) | CheckLink | Checks if a URL is valid and exists. |
CheckLink
(bool) CheckLink( $url = '' )
(string) | $url | The URL to check. If no URL is set, CheckLink uses the $value property of the pbookmark. |
Returns TRUE
if $url
is valid, exists and is not permanently redirected or otherwise broken. If CheckLink returns false, you can check the exact problem by reading one of the following variables:
(int) | $errorcode | An error code from 1 to 10, see the list below. |
(int) | $errorseverity | An error severity from 1 to 10. Everything below 5 is a warning, above 5 is a permanent error. 5 is unknown. |
(string) | $errormessage | A human readable error message, in English. |
Error codes:
code | severity | description |
1 | 1 | No URL entered. |
2 | 1 | Unrecognized URL syntax. |
3 | 10 | No DNS record for the hostname. |
4 | 5 | Could not connect to FTP server. |
5 | 5 | Could not connect to http server, or server returned an empty page. |
6 | 2 | Link is redirected permanently: update the URL. |
7 | 10 | Link is broken, server returned statuscode 4xx, 501, 502 or 505. |
8 | 1 | Link is temporarily unavailable, server returned statuscode 500, 503 or 504. |
9 | 5 | Server returned an unknown statuscode. |
10 | 5 | Server returned an unparseable respons. |