Strip Referral Tag of URL

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


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

Turn the URL into an array, splitting it on the ? and use the first piece of the array.
Nathan RileyFounderAuthor Commented:
Solved on own.
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.