$curl_file, ]; $response = $mastodon->uploadMedia($body); $file_id = $response['id']; // Step 2b - Create the status $status_text = $postTitle. ' -> '.$postURL; $status_data = [ 'status' => $status_text, 'visibility' => $visibility, 'language' => $language, 'media_ids[]' => $file_id, ]; $status_response = $mastodon->postStatus($status_data); // Step 3 - Update Text file $status_id = $status_response['id']; $f = fopen($comment_record, 'a'); fputcsv($f, [$postURL, $status_id]); fclose($f); // Step 4 - Send them to the post // 301 redirect to the mastodon status http_response_code(301); header('Location: '.$base_url.'/'.$instance_user.'/'.$status_id); exit; } ?>