php - Extract location from URL using strpos -



php - Extract location from URL using strpos -

how extract location url using strpos? if can't utilize strpos, alternative?

here's url:

http://www.kijiji.ca/rss-srp-jobs/ontario/c45l9004

i've tried utilize strpos:

if (strpos($url,'ontario') !== false){ echo "yes"; }

but comes nothing. on top of this, need determine source of feed. breakdown's this:

determine source of rss feed (kijiji) check location in $url variable (ontario) if source kijiji.

here's code far:

if (strpos($url,'kijiji') !== false){ if (strpos($url,'ontario') !== false){ echo "ontario"; } }

ideally, id script check location in many different urls, can pinpoint location when displaying job ad.

use parse_url function in order infgo need. see parse_url

php parsing if-statement rss strpos

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

c# - Create a Notification Object (Email or Page) At Run Time -- Dependency Injection or Factory -

Set Up Of Common Name Of SSL Certificate To Protect Plesk Panel -