I parse CSV string and recieve wrong number of columns and i think its because of html entities like this %2C%20.
I recieve wrong number of columns and i think its because of html entities like this %2C%20.
Plese help me to parse CSV string with html entities correcrtly
$file = fopen('data://text/plain,' . $csvString, 'r+');
$fileOffers = [];
while (($data = fgetcsv($file) ) !== FALSE ) {
$fileOffers[] = $data;
}
But in one row i have this URL https://typhur.sjv.io/c/77612/1936847/18771?kw=%22valentines%20day%20gifts%2C%20valentines%20day%20gift%20for%20men%22&prodsku=AF03-DTC
According to provided code, to parse CSV string, containing URL, using PHP, here is updated code:
When the URL is decoded, the value "%2C" becomes comma value, that is, "," value. To implement required functionality, in provided code, this line of code:
is replaced with this line of code:
It can be checked, if it works.