如何使用图形api编码/解码facebook评论回复?

Here is the code i have:

    $message = urlencode($message);
    $params[] = "message=".$message;
    $params = implode('&',$params);

    $curl = curl_init($this->graph_api.$object_id.'/comments?access_token='.$access_token);
    curl_setopt($curl,CURLOPT_POST,true);
    curl_setopt($curl,CURLOPT_POSTFIELDS,$params);
    curl_setopt($curl,CURLOPT_RETURNTRANSFER,true);
    curl_setopt($curl,CURLOPT_SSL_VERIFYHOST,0);
    curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,0);

    $response = curl_exec($curl);
    curl_close($curl);

Currently there is problem with decoding i guess, when there is symbol in the comment reply for example:

comment: >>> contact

will output: & gt;& gt;& gt; contact (without space between & gt;)

same goes to other symbol. i think no problem with encode, only for decode. i'm not sure how this api graph works for decoding. really appreciated for any help.

and one more thing, for private_replies, is it possible to include url? because sometimes there is block/filter by facebook to avoid spamming i guess. any advice for this?

issue solved based on this answer : https://stackoverflow.com/a/7796870/3613026

just decode from database (eg: & gt;& gt;& gt;) and send as decode message (will be: >>>) to graph api. no magic. :)

$message = html_entity_decode($message, ENT_COMPAT, "UTF-8");
$params[] = "message=".$message;
$params = implode('&',$params);

$curl = curl_init($this->graph_api.$object_id.'/comments?access_token='.$access_token);
curl_setopt($curl,CURLOPT_POST,true);
curl_setopt($curl,CURLOPT_POSTFIELDS,$params);
curl_setopt($curl,CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl,CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,0);

$response = curl_exec($curl);
curl_close($curl);