Click here to Skip to main content
16,012,352 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello guys, i was making a small project,

i have a problem in httpwebrequest.

i have solved the applications to login to a certain sites, but
the problem is i am trying to post on my own wordpress site. but it won't send data

VB
Dim postData As String = "author=" & txtUser.Text & "&email=" & txtEmail.Text & "&url=" & txtWebsite.Text & "&comment=" & txtMessage.Text & "&submit"
'If i try this as Post Data, it wont let me post to my wordpress site. it returns nothing.
'If it try this 
' "author=" & txtUser.Text & "&email=" & txtEmail.Text & "&url=" & txtWebsite.Text & "&comment=" & txtMessage.Text & "&submit=&comment_post_ID=" & tempInt '- it returns me 'as code 500, Internal Server error.

    Dim tempcookies As New CookieContainer
    Dim encoding As New UTF8Encoding
    Dim byteData As Byte() = encoding.GetBytes(postData)
    Dim postreq As HttpWebRequest = DirectCast(HttpWebRequest.Create("http://myurl.com/wp-comments-post.php"), HttpWebRequest)
    postreq.Method = "POST"
    postreq.KeepAlive = True


can anyone help me with this?
Posted
Updated 13-Oct-11 7:17am
v2
Comments
bad sect0r 14-Oct-11 4:37am    
Maybe Wordpress does not allow posting data from outside, i don't know exactly. But there is an another idea, if you dont say that you have to use this way: you can use post from email option for send the data. Good Luck
aron quiray 14-Oct-11 7:20am    
how's that? do you have a sample code for that?

1 solution

*Don't know it's an answer or comment*

Navigate to url on your site: /wp-admin/options-writing.php. Scroll down and you will see "Write with e-mail"(or another name) section on this page. More info here: http://codex.wordpress.org/Post_to_your_blog_using_email[^]

Then you can send an email from that address. If you need more information about how to send an email using C# please let me know. :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900