So, I'm trying to add trackbacks to my blog, the code to which I'm writing myself (with your help). To do so, my belief is I need to pull all URLs / URIs out of the body of a post as I post it, pull those pages back, and look for a trackback:ping property
within a rdf:RDF tag within the response. Correct me if I'm wrong. I retrieved the tech specs to the Trackback from:
I can easily get a string representing the body of an entry as I post it. How can I retrieve all URIs/URLs within that string without having to mess with substrings and IndexOf() each possible extension (/, .php, .aspx, etc...)?
I think a regular expression is definitely the way to go for this problem. You define a regular expression to extract URI's, and then use the Matches-method to get all the matching URI's.
I think this regexp is what you need:
That's a .NET regexp though, so you may need to modify it to work on your blogging platform's language....
Got that working... Now, I'm looking into Trackbacks; they're very popular in the blogosphere, but apparently difficult to implement when one writes his own blogging platform. I've researched the tech specs and I've gotten it to the point where by all
logic, it should work. However, my trackback sends keep returning an error saying I'm missing my referring URL despite it being there. The code for such is as follows; if anyone can tell me wtf I'm doing wrong I'd appreciate it.
System.Net.HttpWebResponse objResponse = (System.Net.HttpWebResponse)objRequest.GetResponse();
System.IO.StreamReader sr = new System.IO.StreamReader(objResponse.GetResponseStream());
ReturnStr = sr.ReadToEnd();
return ReturnStr; }
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.