34 lines
No EOL
966 B
PHP
34 lines
No EOL
966 B
PHP
<?php
|
|
|
|
$query = "
|
|
SELECT * FROM data
|
|
WHERE id = {$id};
|
|
";
|
|
|
|
$qresp = pg_query($db, $query);
|
|
$arr = pg_fetch_array($qresp);
|
|
|
|
$ch = curl_init();
|
|
|
|
curl_setopt($ch, CURLOPT_URL,$fediAPIRoute);
|
|
curl_setopt($ch, CURLOPT_POST, true);
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER,
|
|
array("Authorization: {$fediAPIToken}"));
|
|
|
|
$contentO = $arr["text"];
|
|
$contentR = $arr["responsetext"];
|
|
|
|
if ($arr["iscwed"]) {
|
|
$contentCW = $arr["cw"];
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS,
|
|
http_build_query(array('status' => "question: {$contentO}\nresponse: {$contentR}", 'visibility' => "{$fediVisibility}", 'spoiler_text' => "anonymous requestion response (automated); cw: {$contentCW}")));
|
|
} else {
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS,
|
|
http_build_query(array('status' => "question: {$contentO}\nresponse: {$contentR}", 'visibility' => "{$fediVisibility}", 'spoiler_text' => "anonymous requestion response (automated)")));
|
|
}
|
|
|
|
curl_exec($ch);
|
|
|
|
curl_close($ch);
|
|
|
|
?>
|