Strip Referral Tag of URL

I'm wanting to strip off any referral tags from Facebook URL.

Example:
https://www.facebook.com/LiquidWebInc?fref=ts
https://www.facebook.com/CocaColaUnitedStates?brand_redir=1

I'd want to strip off ?fref=ts using PHP before inserting into my database. ?fref=ts is not static and could be other text.  It appears it's all pre-fixed with a "?"
LVL 12
Nathan RileyFounderAsked:
Who is Participating?
 
Nathan RileyFounderAuthor Commented:
Ended up doing with this:
$facebookURL = strtok($facebookURL, '?');

Open in new window

0
 
nap0leonCommented:
Turn the URL into an array, splitting it on the ? and use the first piece of the array.
0
 
Nathan RileyFounderAuthor Commented:
Solved on own.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.