Log in

View Full Version : Resolved Submit form data to multiple Twitter users



mystic7
06-03-2009, 06:45 PM
I had to create a search form for a database containing my boss's Twitter "followers". He wants to send them notices based on the results of the search criteria. In other words if someone mentioned needing a housecleaner and you searched for the word "housecleaner" all the posts and the users who posted them will come up. He then wants to send just those people a message.

I've got it all sorted, but I have one problem. The message has to be submitted using "post", so I have to put it in a form. Once the form is triggered the first time I'm taken away from my script, to the Twitter site.

How can I have the form submit while staying on my script page, so that it can loop and send the message to the next person, and the next, etc?

Here is the relevent part of my code. This works, but as I said, after sending the first post, it leaves the page.


Do While Not rs.EOF
iID = rs("ID") + 1
sTweet = rs("tbl_Tweet")
set rs1 = con2.Execute("SELECT [ID], [tbl_Tweeter] FROM twitter_chat WHERE [ID]=" & iID)
sTweeter = rs1("tbl_Tweeter")
sTweetertwo = Replace(sTweeter, "by ", "")
MyArray = Split(sTweetertwo, " ")
sTweeterthree = MyArray(0)
sComment = "@" & sTweeterthree & " " & rMessage
%>
<form name="tweetSubmit" action="http://twitter.com/statuses/update....us=<%=sComment%>" method="post">
<input type="hidden" name="twitter_username" value="my_username" />
<input type="hidden" name="twitter_psw" value="my_password" />
</form>
<SCRIPT LANGUAGE="JavaScript">
document.tweetSubmit.submit();
</SCRIPT>
<%
rs.MoveNext
Loop
Response.Write "</table>"
End If
rs.Close
set rs = Nothing
rs1.Close
set rs1 = Nothing
con2.Close
set con2 = Nothing


EDIT: I added target=_new to my form so now it opens the action page in a new window and submits the data, and the rest of the script loops and prints out all of the relevent posts, but the form submittal only works that first time around the loop. Any ideas? I'm trying a 5 second pause in the script, maybe that will help. If not any ideas would appreciated.

mystic7
06-10-2009, 06:06 PM
Nevermind, got it. Used http_referrer.