And So I almost possess a pingback sender ready for my rails application (people publish links to content and donate for them). Almost.

I have lent heavily in the code here:

I modified the slightly for my reasons:

require 'net/http'
require 'uri'

class Trackback

  @data = { }

  def initialize(link_id)
    link = Link.find(link_id)
    site =

    if link.nil?
      raise "Could not find link"

    if link.created_at.nil?
      raise "link not published"

    @data =  {
      :title =>,
      :excerpt => link.description,
      :url => "http:://{link.to_param}/donations/new",
      :blog_name => "My App"

  def send(trackback_url)
    u = URI.parse trackback_url
    res = Net::HTTP.start(, u.port) do |http|, url_encode(@data), { 'Content-Type' => 'application/x-www-form-urlencoded; charset=utf-8' })
    end "TRACKBACK: #{trackback_url} returned a response of #{res.code} (#{res.body})"
    return res


  def url_encode(data)
    return {|k,v| "#{k}=#{v}"}.join('&')


Appears like I am delivering links effectively to my wordpress blog however when I consider the link shown on the trackback I recieve this:"

All I would like may be the other half of the lengthy string. Have no idea why the present location on my small browser is coming inside.

I have attempted this on a couple of my blogs therefore it does not appear to become problem associated with my wordpress installation.

UPDATE: Okay this can be a little odd: I checked the page source also it shows the right link. After I click it, however, I recieve forwarded to the strange link I pointed out above. Is a Wordpress Problem?

Whoops! Appears like it had been only a syntax error. A sneaky double colon

This line

url => "http:://{link.to_param}/donations/new"

Should obviously end up like this

url => "{link.to_param}/donations/new",