TopKeyword Snippet

Hallo Forums Experten,

habe jetzt nach Installation ein TopKeyword Snippet welches ich in meine Wordpress Seite einbinden möchte. Jedoch war die Seite nach Kopieren in die header.php im head nicht mehr erreichbar, worauf muss ich achten und ist dieses Snippet überhaupt lauffähig oder habe ich etwas vergessen zu editieren ? :

<?php // This function will call the API to get best keyword for current URL. // Then it writes the list of best keywords in a HTML list function DisplayTopKeywords($url = "") { // Do not spend more than 1 second fetching the data @ini_set("default_socket_timeout", $timeout = 1); // Get the Keywords data $url = empty($url) ? "http://". $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] : $url; $api = "https://www.nutringo.de/analytics/?module=API&method=Referrers.getKeywordsForPageUrl&format=json&filter_limit=10&token_auth=840b398dfcc96cc0ad52ac85f16babf5&date=previous1&period=week&idSite=1&url=" . urlencode($url); $keywords = @json_decode(file_get_contents($api), $assoc = true); Common::sendHeader('Content-Type: text/html; charset=utf-8', true); if ($keywords === false || isset($keywords["result"])) { // DEBUG ONLY: uncomment for troubleshooting an empty output (the URL output reveals the token_auth) // echo "Error while fetching the Top Keywords from Piwik"; return; } // Display the list in HTML $url = htmlspecialchars($url, ENT_QUOTES); $output = "

Top Keywords for $url

    "; foreach($keywords as $keyword) { $output .= "
  • ". $keyword . "
  • "; } if (empty($keywords)) { $output .= "Nothing yet..."; } $output .= "
"; echo $output; } DisplayTopKeywords();

War schon vor ein paar Tagen hier keiner eine Idee was am Code nicht richtig sein könnte oder gibt es noch einen anderen Ort wo ich diesen Code einbauen könnte. außer auf der header.php ?