jeddi
02-21-2010, 06:53 PM
Hi,
I am using a text file that contains tags.
I download it everyday and want to process it with my php script.
It is a very annoying file as it does not contain
product codes except when referencing the sales page.
For example:
<salespage>http://example.com/79741/sales_page.php/</salespage>
Now I could put the sales page into my tabe and index it ...
... but that would waste a lot of space,
as the "http://example.com/" and "sales_page.php" are always the same,
only that number in the middle changes.
I just need to store the number in a column "prod_id"
What is the best way to go through this text file
and convert:
<salespage>http://example.com/79741/sales_page.php/</salespage>
to
<prod_id>79741</prod_id>
Although this is an xml file, I want to make this change to the file before I use simplexml_load_file($file);
When the change is done ı will open it up with simplexml_load_file($file);
As there are several thousand records should I be using a regular experssion to do this or is there quicker method ?
Thanks
.
I am using a text file that contains tags.
I download it everyday and want to process it with my php script.
It is a very annoying file as it does not contain
product codes except when referencing the sales page.
For example:
<salespage>http://example.com/79741/sales_page.php/</salespage>
Now I could put the sales page into my tabe and index it ...
... but that would waste a lot of space,
as the "http://example.com/" and "sales_page.php" are always the same,
only that number in the middle changes.
I just need to store the number in a column "prod_id"
What is the best way to go through this text file
and convert:
<salespage>http://example.com/79741/sales_page.php/</salespage>
to
<prod_id>79741</prod_id>
Although this is an xml file, I want to make this change to the file before I use simplexml_load_file($file);
When the change is done ı will open it up with simplexml_load_file($file);
As there are several thousand records should I be using a regular experssion to do this or is there quicker method ?
Thanks
.