Trying to display text in a block in a plugin page

I’m writing a plugin that needs to display text retrieved from another website (text as in lyrics) and the string I get from the query is displayed in a line, while I’d like to display it on multiple lines. When I enter the query address manually in my browser, I get a single line also, but when I display the source code, it’s displayed on multiple lines.

Any idea on how I can achieve that?
Here’s my code so that you get an idea of what I mean:

public function get_lyrics($artist, $song){
$url=”https://makeitpersonal.co/lyrics?artist=”.$artist.”&title=”.$song;
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data= curl_exec($ch);
curl_close($ch);
return ($data);
}

and where it’s called:

echo “Lyrics: “.$this->get_lyrics($artist, $song).”</div>”;

I tried finding a similar question before asking, but as you might have noticed, I had a hard time describing my question precisely enough to make it specific and match any previous question. Sorry if it’s been answered before :/

Anyways, thanks for your time! 🙂

Read more here:: Trying to display text in a block in a plugin page

Leave a Reply

Your email address will not be published. Required fields are marked *