I am using PHP 7.4.1
.
I am trying to parse a rss feed from google.
My links look like the following:
https://www.google.com/url?rct=j&sa=t&url=https://www.timeslive.co.za/sunday-times/news/2020-11-01-hawks-following-former-steinhoff-ceo-markus-joostes-money/&ct=ga&cd=CAIyGjRm
https://www.google.com/url?rct=j&sa=t&url=https://www.politifact.com/factchecks/2020/oct/31/raphael-warnock/fact-checking-raphael-warnocks-claim-georgia-sen-k/&ct=ga&cd=CAIyGm
https://www.google.com/url?rct=j&sa=t&url=https://www.benzinga.com/news/20/10/18156683/last-weeks-notable-insider-buys-ibm-intel-raytheon-and-more&ct=ga&cd=CAIyGmM3Yjk5YjRlYWU
https://www.google.com/url?rct=j&sa=t&url=https://stocksregister.com/2020/10/31/insider-trading-at-avino-silver-gold-mines-ltd-nyseasm-what-did-we-note/&ct=ga&cd=CAIyGmM3Yjk5Y
https://www.google.com/url?rct=j&sa=t&url=https://www.businessinsider.co.za/who-received-an-sms-from-markus-jooste-2020-10&ct=ga&cd=CAIyGmM3Yjk5YjRlYWU3MWY2MDY6Y29tOmVuOlVT&am
https://www.google.com/url?rct=j&sa=t&url=https://stocksregister.com/2020/10/31/insider-trading-at-veritone-inc-nasdaqveri-what-did-we-note/&ct=ga&cd=CAIyGmM3Yjk5YjRlYWU3MWY2M
https://www.google.com/url?rct=j&sa=t&url=https://heavy.com/sports/las-vegas-raiders/jj-watt-stephon-gilmore-trade-targets/&ct=ga&cd=CAIyGmM3Yjk5YjRlYWU3MWY2MDY6Y29tOmVuOlVT&a
https://www.google.com/url?rct=j&sa=t&url=https://stocksregister.com/2020/10/31/insider-trading-at-truecar-inc-nasdaqtrue-what-did-we-note/&ct=ga&cd=CAIyGmM3Yjk5YjRlYWU3MWY2MD
https://www.google.com/url?rct=j&sa=t&url=https://stocksregister.com/2020/10/31/insider-trading-at-veeco-instruments-inc-nasdaqveco-what-did-we-note/&ct=ga&cd=CAIyGmM3Yjk5YjRl
https://www.google.com/url?rct=j&sa=t&url=https://stocksregister.com/2020/10/31/insider-trading-at-21vianet-group-inc-nasdaqvnet-what-did-we-note/&ct=ga&cd=CAIyGmM3Yjk5YjRlYWU
I would like to get the real link from url=
and cut out the end /&ct=ga&cd=CAIyGjRm
.
I tried str_replace
however, parsing out the end is difficult as it differs.
Any suggestions how to just get the link?