How can I automatically submit the Facebook URL sharer form?
I am trying to figure out, how can I automatically submit a url at 开发者_StackOverflow社区the following page
http://www.facebook.com/sharer.php
without actually clicking on the submit button.
Thanks.
You can find that from the page source. There is a form defined...
<form action="/sharer.php" method="get">
and the button is a submit button, which means that when you click the button, the form data is sent as a get request to http://www.facebook.com/sharer.php - in other words, it submits back to itself.
Update - asker wants to know how to submit the form without clicking on the link.
The form is:
<form action="/sharer.php" method="get">
<input type="text" class="inputtext DOMControl_placeholder" id="share_input" name="u" placeholder="http://" value="http://" title="http://" />
<input type="hidden" name="appid" value="2309869772" />
<label class="mrm uiButtonNoText uiButton uiButtonConfirm uiButtonMedium" id="share_submit">
<input value="Share" type="submit" />
</label>
</form>
So you need to GET a URL with form data something like the following
http://www.facebook.com/sharer.php?u=your_encoded_url&appid=yourappid
精彩评论