PHP
Generate content using the TrendScribbr API from PHP.
php
<?php
$apiKey = 'your-api-key-here';
$baseUrl = 'https://your-domain.com/agents/api';
function generateArticle($topic) {
$url = $baseUrl . '/articles/generate/';
$data = http_build_query([
'content_type' => 'article',
'custom_topic' => $topic
]);
$context = stream_context_create([
'http' => [
'method' => 'POST',
'header' => [
'X-API-Key: ' . $apiKey,
'Content-Type: application/x-www-form-urlencoded'
],
'content' => $data
]
]);
$result = file_get_contents($url, false, $context);
return json_decode($result, true);
}
// Usage
$result = generateArticle('The Future of AI in Healthcare');
print_r($result);
?>