How to Add suffix in the middle of string?

I import RSS article feed into a mysql table.
in the article field i have few URL links inside it. in the mddle of the text that I imported.
For example (the URL are just for test…)
I need to add a suffix to the end of each URL links. the links are not the same. the links are from many domains. and the links are not the same! for example in on article the link is: http://www.XXXXX.co.il/sudent/?Stuid=18498 and in the second article is : http://www.???.co.il/sudent/?Stuid=sdsds3 and in the 3 article is: http://www.learn.com/exam/mid__43465.html or http://www.l???n.com/exam/mid_reading__p_14901.html

i can find the string that start with https://www.domain.com/??? but i dond know what are the ??? will be . i need to add the suffix in the en of the links. i know the link end wit " , so i need to add the suffix before the " and after the https://www.XXXXX.com/???

I need to add to each on of the link suffix ,each domain recived a diffrent suffix. Each day my uers adding many new records with url to this table without the suffix. and i need to add for them their suffix.

example for new urls:(please ignore the “_”)

http://www.111111.co.il/sudent/?Stuid=18498
http://www.111111.co.il/Product/aa-build-note-CD-Back-Blue.htm
http://www.222222.com/Product/mm-Style-In-phones-number.htm
http://www.22222.com/exam/mid_reading__p_14901.html
https://www_.3333.com/case/cart.html?action=_now&exame_id=14901
http://www.22222.com/calss/mi-reading-note-p-14901.html
i need to add suffix to each doamin at the end of the url for example : each suffix style is according to the domain. for www.study.co.il domain , need to add ?342343 for www.learn.com domain , need to add ?3das4sfs2343 for www.XXXX.com domain , need to add ?3das4sfs2343

do you have an idea how to make it work?``

if you want to add the domain an suffix before inserting into database all you need to is concatenate the domain + the suffix like this

[php]
$domainSuffix = $domain.$suffix;
[/php]

by using the dot to join both strings

I don’t know how to use PHP very good.
It easy for me to run SQL after the import of the text to the table.
and there are many domains name in the table, each one of them need to received differences suffix
in the field the test is HTML
for example :
the field after the imort look like :


u1100232 cc01 433rrr gfgfgfg gfgfgfg

gfgjgh-mhfg4gg666671
AAA #: 1ter4571a, Date: K10.00Log In
- Model: gdfgdfgdffg- 544
- Color: Green
- Material: PCB
- On board />-

frequency
- RS / interface
- channels
- meters
- Transmit power: 10mW
- voltage: 2.7V
- 111/ 222 / 333

rate
- 8N1 / 81 / 8O1 data

I need to add a suffix at the end of the URL, Some time i have few urls in the same field.
and there are many domains names (I know the names and what suffix needed to be addd to each doamin)

I don’t know if I understand what you need.

[php]
$url = ‘http://www.abc.com/’;
$domain = parse_url($url, PHP_URL_HOST); // Extract domain from URL

// Switch domain
switch($domain) {
case ‘www.abc.com’:
$url .= ‘?abc_suffix’; // Append suffix for abc.com
break;
case ‘www.xyz.com’:
$url .= ‘?xyz_suffix’; // Append suffix for xyz.com
break;
}
[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service