In response to an API call, I'm getting a full HTML script. Full means it includes HTML CSS and Javascript. Now I have that HTML as string in PHP variable.
$content = '<html>
<head>
<script>--Some javascript and libraries included--</script>
<title></title>
</head>
<body>
<style>--Some Styling--</style>
</body>
</html>';
Now, what is the best way to save this variable in Database and How?
- As a string with VARCHAR or TEXT type?
- As a string with Base64 Encoded with VARCHAR or TEXT type?
- As a Binary with BLOB type?
Or any other you would like to suggest(May be Serialize or Pack)?
addslashes(deslash($content));. deslash function written by wp core itself to make it generalize and store it on WordPress database. It helps to work on.