get data from text area and post to a wall onfaceb

2019-08-20 03:45发布

问题:

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);
?>