Note that there are some explanatory texts on larger screens.

plurals
  1. PORails: Why am I getting the wrong link on this pingback?
    primarykey
    data
    text
    <p>So I almost have a pingback sender ready for my rails app (people post links to content and donate to them). Almost.</p> <p>I've borrowed heavily from the code here: <a href="http://theadmin.org/articles/2007/12/04/mephisto-trackback-library/" rel="nofollow noreferrer">http://theadmin.org/articles/2007/12/04/mephisto-trackback-library/</a></p> <p>I modified the slightly for my purposes:</p> <pre><code>require 'net/http' require 'uri' class Trackback @data = { } def initialize(link_id) link = Link.find(link_id) site = Link.website if link.nil? raise "Could not find link" end if link.created_at.nil? raise "link not published" end @data = { :title =&gt; link.name, :excerpt =&gt; link.description, :url =&gt; "http:://www.MyApp.org/links/#{link.to_param}/donations/new", :blog_name =&gt; "My App" } end def send(trackback_url) u = URI.parse trackback_url res = Net::HTTP.start(u.host, u.port) do |http| http.post(u.request_uri, url_encode(@data), { 'Content-Type' =&gt; 'application/x-www-form-urlencoded; charset=utf-8' }) end RAILS_DEFAULT_LOGGER.info "TRACKBACK: #{trackback_url} returned a response of #{res.code} (#{res.body})" return res end private def url_encode(data) return data.map {|k,v| "#{k}=#{v}"}.join('&amp;') end end </code></pre> <p>Looks like I'm sending links successfully to my wordpress blog but when I look at the link displayed on the trackback I get this: <a href="http://www.theurl.com/that/my/browser/iscurrentlypointing/at/http:://www.MyApp.org/links/#" rel="nofollow noreferrer">http://www.theurl.com/that/my/browser/iscurrentlypointing/at/http:://www.MyApp.org/links/#</a>{link.to_param}/donations/new"</p> <p>All I want is the second half of this long string. Don't know why the current location on my browser is sneaking in there.</p> <p>I've tried this on two of my blogs so it doesn't seem to be problem related to my wordpress installation.</p> <p>UPDATE: Okay this is a little odd: I checked the page source and it shows the correct link. When I click on it, however, I get directed to the weird link I mentioned above. Is this a Wordpress Issue?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload