We have a client who wants to output cinema listings on their website. This particular cinema has provided us with a link to retrieve the information from. This link is simply outputted in plain text, with the elements seperated by ~|~
I have set up a curl script to grab this plain text from the url and display it as plain text on the clients website. However I now need a way of pulling this information into div classes so I can style it with CSS. Also there are a few links which I need to format into buttons that link to book the show.
This is my current code:
<?php
function curl_get_file_contents($URL)
{
$c = curl_init();
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_URL, $URL);
$uf_contents = curl_exec($c);
curl_close($c);
$contents = str_replace("~|~"," ",$uf_contents);
if ($contents) return $contents;
else return FALSE;
}
echo "<ul>";
echo curl_get_file_contents("THE URL");
echo "</ul>"
?>
All this is doing currently is replacing the separators with a space. I'm really confused on this one and I'm not 100% proficient with PHP. Any ideas?
Thanks in advance
~|~is a weird separator :\