0

As far as i know a trackback it's a recognised standard ping for a custom URL, right?

so, according to this how can i retrieve how many trackbacks for http://example.com/article/22/name-article ?? and the URL of those 'trackbacks' ?

I never worked with those before, if posible i'd like to know howto in PHP or, if posible, in js,

any tip or clue would be wellcome

Toni Michel Caubet
  • 19,333
  • 56
  • 202
  • 378

1 Answers1

1

You must define an entry point, in all your pages, that will recieve all the trackback requests. The Trackback specification do it like this:

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
    <rdf:Description
        rdf:about="http://www.foo.com/archive.html#foo"
        dc:identifier="http://www.foo.com/archive.html#foo"
        dc:title="Foo Bar"
        trackback:ping="http://www.foo.com/tb.cgi/5" />
</rdf:RDF>

Where <rdf:RDF></rdf:RDF> is where you declare that this page uses Trackbacks and the parameters inside <rdf:Description /> are specific to your page. dc:identifier is your exact page URL and trackback:ping is the Trackback entry point.

There is no way in JS, as a client side language, to store the trackback count for each page, so the trackback:ping should be a PHP script that check the title from the request query and store it somewhere (DB, file, log...)

I made this VERY simplified Trackback entry point:

<?php
    $theUrl = $_GET['url'];
    if (!$theUrl) {
        printError(NO_URL);
        die();
    }
    $theUrl = Sanitize::clean($theUrl, SQL) // Your anti-SQL injection method
    $theId = getIdFromUrl($theUrl);
    countIntoDataBase($theId); 
?>

And, last but not least, is important to bear in mind that Trackback protocol is very prone to SPAM, as this answer states: Trackbacks in PHP

Community
  • 1
  • 1
Coquevas
  • 609
  • 6
  • 11