I am asking for following details from user in form:
- Product name:
- product Price:
- Product URL:
The user can add multiple items in cart. During checkout, I want to filter URL like if user enter below multiple URL in the form and these multiple url's will be inserted in products table.
- aliexpress.com/product/phone_cover
- aliexpress.com/product/phone_battery
- nike.com/cat/shoes
In this case I want to get host (Domain) of URL like:
- aliexpress.com
- nike.com
and add once in the database store table. For example, user added 2 URLs from aliexpress and one for nike so I want to store one time aliexpress and one time nike in store_url column of store table in database. I am getting host URL by the code below:
foreach ($data as $show)
{
$var= parse_url($show->produst_url);
echo $var['host'];
}
below are database tables
-------- -------
products store
-------- -------
id id
product name products_id
product url store url
product price
Any help is appreciated. I have tried my best to explain you my problem but if you still need some more detail I will be happy to explain you more. Thanks