How I can give a link Reddit API PHP

25 Views Asked by At

I am sending content to Reddit with the following code. However, when I want to link a word, it always places the link next to the word. For example, (Hello) [Link]. I want the link to be directly attached to the word. How can I achieve this?

$richtext_json = json_encode([
    "document" => [
        [
            "e" => "par",
            "c" => [
                [
                    "e" => "text",
                    "t" => "[hello](https://xxxxx.com)?",
                    "f" => []
                ]
            ]
        ]
    ]
]);



// post data: posting a link to a subreddit
$postData = array(
    'title' => $subredditPostTitle,
    'sr' => $subredditName,
    'richtext_json' => $richtext_json,
    'kind' => 'self'
);

Can you solve my problem?

0

There are 0 best solutions below