Post to Reddit via URL - reddit

Is it possible to post a link to Reddit via URL?
For example for Facebook you can do
<a href="https://www.facebook.com/sharer/sharer.php?u=http://stackoverflow.com">
Share Stackoverflow on your profile!
</a>
Does Reddit have an equivalent endpoint I can hit to share a URL?

There are several ways to do this, depending on exactly what kind of application you have.
If you're making something interactive, you can take a user to the submit page with a URL and title already filled in. The following URL will open the reddit submit form with a link to this question:
http://www.reddit.com/submit?url=https://stackoverflow.com/questions/24823114/post-to-reddit-via-url&title=Post%20to%20Reddit%20via%20URL
If you just want people to be able to submit your site or blog post to reddit, you can use a reddit button on your page instead.
If you're writing an app or a script where you need to post a URL to reddit, you can use the /api/submit route in the reddit API. If the user that is submitting the link has less than 2 link karma, then a CAPTCHA will probably be given.

Related

How to link old Twitter posts to new website

I'm building a new website for a client and they have Twitter posts that link to there old website. The urls are formatted like so: website name/blog post title, however, the new url to those posts are as follows: website name/blogs/blog post title. As far as I know tweets can't be altered, so my question is how do I link these existing tweets to there corresponding blog posts that have the new blog path? How would this be handled? Deleting all the tweets would be very destructive, what is, if any, the way to handle this?
It depends on how many there are - but the simplest answer would be "redirects". Put a redirect page at each of the old URLs forwarding the browser to the new URL.

Add twitter share button to each blog post on tumblr

I'm working on a tumblr blog and I would like to add the twitter share button at the end of each blog post. I know how to get the button for the code and I've been able to get it on a post successfully. However I want it to be on all my post so I don't want to have to add the code at the end of each blog posts's html.
I thought I could avoid this by putting the code in my blogs html. I added in between the block:Post and /block:Post. This works for the most part, the only thing is that when I'm on my blog the link shows up on the post preview and shows how many shares my blog has had and while I'm on an individual post it shows how many shares the post has.
How can I add it such that it only shows the number of shares the post has and will be added to each post automatically.
I think this should do the job:
http://ialreadydontlikeyou.tumblr.com/post/1167220523/implementing-the-tweet-button-on-posts-in-tumblr#.U7_VW41_v_E
It needs special workaround, as you need to place many tweet buttons on the same page.

Post comment to other website from my site using a form

I want to post some data to other web page from my page using a pseudo-form. If user post something using the form of my page as a result this will be posted to a target page of other domain which exist to a different server.
Say my site is http:// abcd .com and the target site is http:// xyz .com
If user post a comment using my form this will be posted to xyz.com.
First I tried as followed:-
$.ajax({
url:'http://xyz.com/cmnt_next.php',
type:'post',
data:{'cmntid':100,'user':'guest','cmnt':'Hello world'},
success:function(result){
alert("res: "+result);
}
});
Finally I found that ajax dose not send request to external domain. I don't have any other Idea to do it. I want to know what is the legal way to do it, with their permission. What do I need to know to get access to post, also if needs to 'Login' to the target site before posting through my webpage. I need any tips & solution to do this thing.
Thank you...
The "legal" way to do this would be to use an API that the site provides for you to log in and/or make posts to xyz.com. If they don't, then they probably don't want you to do this, and then you probably shouldn't be doing it.

Login to a site using the cocoa framework

I am creating an ios app that needs to download a html page and extract some information from it. To get to the page I also need to login. I have looked everywhere for some code on how to login to a site using the cocoa framework, but every answer I see only seems to answer half the question. Here is the login site: romres.ist-asp.com. I need some code for writing something in the first field (the other two are left blank), then submit the form and then I need to be able to see the next page. I believe apps like Facebook should use som of the same technology, where you log in to a facebook and then you can see the contents of your profile.
Basically what you want to do is called scraping.
Scraping is really easy for sites that don't require authentication, but in your case what you should do is to inspect the POST request being made when logging in the site your interested in (try to understand of the service respond) and the POST request made, when already logged in, to retrieve each page.
The purpose of all of this is to have later the possibility to simulate regular HTTP requests that should came from a browser via code.
If you have any doubt ask in the comments.

tweet this link in rails app

I am surprised I couldn't find it on google, what's the best way to add a "tweet" this link to post a url and a description to the user's twitter account?
The 'tweet this link' feature is extremly simple and does not require additional Rails features. It is as simple as:
<a href=http://twitter.com/home?status=Name_and_Address_of_the_twitter_post_that_you_want_everyone to_see_on_twitter>Add to Twitter</a>
To use Rails code, it would be something like:
= link_to "tweet me", "http://twitter.com/home?status=#{#post.short_name} #{post_url(#post)}"
Some remarks:
the status should not be bigger than 140 chars (you can use either an external service as bit.ly or you can write your own controller that answers to small addresses and that redirects to the post)
you can also implement a tracking mechanism that could detect how many users clicked on the 'tweet this' link
The accepted answer used to work for me, but it stopped at some point. A link like this is now working for me:
https://twitter.com/intent/tweet?text=Some%20description&url=https://example.com/someurl

Resources