"; // Detect webmention endpoint define in twtxt.txt as `# webmention = URL` $targets_webmention_endpoint = getSingleParameter("webmention", file_get_contents($mention["url"])); if (!isset($targets_webmention_endpoint)) { echo "
No endpoint found in: ".$mention["url"]."
"; } else { $new_twt_url = $public_txt_url."#:~:text=".$datetime; //$target_url = $mention["url"]; $payload = "source=".$new_twt_url."&target=".$mention["url"]; //echo $payload; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $targets_webmention_endpoint); curl_setopt($curl, CURLOPT_POST, TRUE); curl_setopt($curl, CURLOPT_POSTFIELDS, $payload); $data = curl_exec($curl); $status = curl_getinfo($curl, CURLINFO_RESPONSE_CODE); curl_close($curl); echo "A webmention was send to: ".$targets_webmention_endpoint." (Status: $status)
"; } }