get data from text area and post to a wall onfacebook

跟風遠走 提交于 2019-12-25 02:06:41

问题


not sure if this is possible, but what i need to do is take the data from my text area and let the user post that to their wall.

my code snippet

<div align="center">
<form method="GET" action="translate.php">
<textarea name="status2" cols="50" rows="5"<input type="text"/>
<?php echo str_ireplace(array     ('old','awkward','all','again','behind','along','alright','hello','among','children','yes','child','kids','food','barnard castle','beer','book','blow','beautiful','bird','burst','brown','burn','boots'), 
array ('auld', 'aakwad', 'aall','agyen','ahint','alang','alreet','alreet','amang','bairns','aye','bairn','bairns','bait','barney','beor','beuk','blaa','bonny','bord','borst','broon','bourn','byeuts'),$status); ?> 

</textarea><br>

<input type="submit" value="post to wall" />
</form>

</div>

<?php

$args = array(
'message'   => 'Hello World',
'link'      => 'http://apps.facebook.com/geordie-status/',
'caption'   => 'Translate from English to Geordie'
);
$post_id = $facebook->api("/$uid/feed", "post", $args);

?>

the default message 'Hello World' posts to the wall, but i would like to replace that with the text in 'status2' text area. Is this possible?

Thanks


回答1:


<textarea name="status2" cols="50" rows="5"<input type="text"/>

Doesn't make sense. Guessing that your textarea is well coded in your real snippet. You should have the value of the textarea inside $_GET['status2'], so change traslate.php:

$args = array(
'message'   => $_GET['status2']
...

this is the code i've written for the test:
index.html

<form method="GET" action="server.php">
    <textarea name="status2"></textarea>
    <input type="submit" value="go"/>
</form>

server.php

<?
print_r($_GET);
?>


来源:https://stackoverflow.com/questions/16469495/get-data-from-text-area-and-post-to-a-wall-onfacebook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!