I use the following code as a client for sending trackbacks to other blogs. When I use the same script for sending trackbacks to my own website, what happens is that all the spaces get stripped. It can be seen in the first entry here:
http://www.drumster.com/trackback.asp?var=154
Now this does not happen when I send trackbacks to other peoples blogs, it gets registered fine.
The script that recieves the trackback ping also recieves the trackbacks fine from other websites, so even that does not have a problem. For reference I am pasting the script of the trackback reciever which recieves the pings.
This is the client code:
Code:
<%@ Language=VBScript %>
<%
Option Explicit
Dim strTitle, strURL, strExcerpt, strBlogName, objHTTP, strTrackBackURL
strTitle = Request.Form("title")
strExcerpt = Request.Form("excerpt")
strURL = Request.Form("url")
strBlogName = Request.Form("blog_name")
strTrackBackURL = Request.Form("trackbackurl")
'// Check if this form has been submitted or not
If IsEmpty(strURL) Then
'// Nope, show the form
%>
<html>
<head><title>TrackBack Client Example</title></head><body>
<h2>TrackBack Client Example</h2>
<form method="POST" action="client.asp">
TrackBack URL: <input type="text" name="trackbackurl"><br /><br />
Title: <input type="text" name="title"><br />
Excerpt: <input type="text" name="excerpt"><br />
URL*: <input type="text" name="url"><br />
Site/Blog Name: <input type="text" name="blog_name"><br />
<input type="submit" name="submit" value="Send TrackBack!">
</form>
</body></html>
<%
Else
'// Send TrackBack:
'// Create object
Set objHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
'// Send TrackBack
objHTTP.Open "POST", strTrackBackURL, false
objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objHTTP.Send ("title=" & strTitle & "&excerpt=" & strExcerpt & "&url=" & strURL & "&blog_name=" & strBlogName)
'// Check if it was successful or not
If InStr(1, objHTTP.responseText, "<error>0</error>") Then
'// Success!
Response.Write "Your TrackBack has been sent successfully!"
Else
'// Failure
Response.Write "Your TrackBack has <strong>FAILED</strong>"
End If
'// Destroy object
Set objHTTP = Nothing
End If
%>
This is the code for the script that recieves the pings
Code:
<%
Dim strTitle, strURL, strExcerpt, strBlogName, strBlogID
strTitle = Request("title")
strExcerpt = Request("excerpt")
strURL = Request("url")
strBlogName = Request("blog_name")
strBlogID = Request("var")
'// Set Content-Type
Response.ContentType = "text/xml"
'// Check if there is a url or not
If IsEmpty(strURL) Then
'// No url, return error
Response.Write "<?xml version=""1.0"" encoding=""iso-8859-1""?>"
Response.Write "<response>"
Response.Write "<error>1</error>"
Response.Write "<message>No URL included in TrackBack</message>"
Response.Write "</response>"
Response.End
End If
'Everything else is optional, so no need to check that, so display success
Response.Write "<?xml version=""1.0"" encoding=""iso-8859-1""?>"
Response.Write "<response>"
Response.Write "<error>0</error>"
Response.Write "</response>"
'Now you can do anything you want with the data.
Dim DB, RS,RS2,inuse
Set DB=Connect(trackMDB)
Set RS= Server.CreateObject("ADODB.Recordset")
RS.open "SELECT * FROM trackbacks",DB,adOpenStatic,adLockPessimistic
RS.addnew
RS("Title") = strTitle
RS("Excerpt") = strExcerpt
RS("url") = strURL
RS("blogname") = strBlogName
RS("blogid") = Request("var")
RS.update
Set RS2= Server.CreateObject("ADODB.Recordset")
RS2.open "SELECT * FROM total where blogid=" & Request("var"),DB,adOpenStatic,adLockPessimistic
if (RS2.bof or RS2.eof) then
RS2.addnew
RS2("blogid") = Request("var")
RS2("total") = 1
RS2.update
else
RS2("total") = RS2("total") + 1
RS2.update
end if
'so you can later display it again.
%>