fork download
  1. <?php
  2.  
  3. $apiKey = 'd682e8ddb5bf4d2e4913a92d1e9a1640a66a080b6f95e695dd2bf0a2';
  4. $text = "Your long text here...";
  5.  
  6. $data = [
  7. 'extractors' => 'entities,topics,summary',
  8. 'text' => $text,
  9. ];
  10.  
  11. $ch = curl_init();
  12.  
  13. CURLOPT_URL => 'https://a...content-available-to-author-only...r.com',
  14. CURLOPT_RETURNTRANSFER => true,
  15. CURLOPT_POST => true,
  16. CURLOPT_POSTFIELDS => http_build_query($data),
  17. CURLOPT_HTTPHEADER => [
  18. "x-textrazor-key: $apiKey",
  19. "Content-Type: application/x-www-form-urlencoded",
  20. ],
  21. ]);
  22.  
  23. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  24. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  25.  
  26.  
  27. $response = curl_exec($ch);
  28.  
  29. if (curl_errno($ch)) {
  30. echo 'Error: ' . curl_error($ch);
  31. } else {
  32. echo $response;
  33. }
  34.  
  35. ?>
  36.  
Success #stdin #stdout 0.03s 26000KB
stdin
Standard input is empty
stdout
Error: Could not resolve host: api.textrazor.com