Mike :nixos: on Nostr: This is my function: function check_image_url($url) { $ch = curl_init($url); ...
This is my function:
function check_image_url($url)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // Follow redirects
curl_setopt($ch, CURLOPT_TIMEOUT, 2); // Set a timeout
curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
return $http_code != 404;
}
Published at
2024-07-22 14:06:13Event JSON
{
"id": "cdc9089eadede73ec068338b09c0aad3bf4a53f1c4dfc93715b7afc349e4ea65",
"pubkey": "7743d6497523e4c3868bafe60fdf6f6d6da58b0e666f5b52c7c8b9970f7274b6",
"created_at": 1721657173,
"kind": 1,
"tags": [
[
"e",
"e7302de4584ba5e383dbf1774f0036f334d02ae1c70bb011b493e61ef7bc75e9",
"wss://relay.mostr.pub",
"reply"
],
[
"proxy",
"https://fosstodon.org/users/codemonkeymike/statuses/112830524546602074",
"activitypub"
]
],
"content": "This is my function:\n\nfunction check_image_url($url)\n{\n $ch = curl_init($url);\n curl_setopt($ch, CURLOPT_NOBODY, true);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // Follow redirects\n curl_setopt($ch, CURLOPT_TIMEOUT, 2); // Set a timeout\n curl_exec($ch);\n $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);\n curl_close($ch);\n\n return $http_code != 404;\n}",
"sig": "97a05d131de2cbadf3e6907ebdd35821173b09f794aa163092d8bcf757d06852a1be56529e156fdbe19d40186090e55f1041d27fc733914da6cedb941e889377"
}