Hello Sorry in advance if you find this question dumb. But i am integrating 2checkout payment system in my shoping cart. and 2checkout response in this way
www.mydomain.com/checkout.php/?middle_initial=&li_0_name=Jackets&li_0_productid=4&li_1_name=shirts&li_1_productid=2
Now i want to get all products ids and name.
Here is the Answer
$url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$matches = null;
preg_match_all('/li_\d+_productid=(?<productIds>\d+)/', $url, $matches);
print_r($matches['productIds']);
$count = count($matches['productIds']);
for ($x = 0; $x < $count; $x++) {
echo $_GET['li_'.$x.'_productid'];
echo $_GET['li_'.$x.'_name'];
}
First Find the count of total numbers of product_ids using preg match from url then run loop.