
Small php coding job
- or -
Post a project like this4549
£10(approx. $13)
- Posted:
- Proposals: 2
- Remote
- #388429
- Awarded
Description
Experience Level: Entry
Estimated project duration: 1 day or less
General information for the website: We provide serviced office space
Description of requirements/features: In a section of my website, my URLs are formatted like this:
http://www.angeloffices.com/index.php/city/LOCATION1/LOCATION2
For example:
http://www.angeloffices.com/index.php/city/Godstone/Surrey
The bit that always stays the same is http://www.angeloffices.com/index.php/city/
But some URLS only have one location rather than two, like this:
http://www.angeloffices.com/index.php/city/bristol
Some URLS have spaces in the place names which are handled like this:
http://www.angeloffices.com/index.php/city/Aztec%20West/Bristol
I would like a little php script that parses the URL and creates two variables from LOCATION1 and LOCATION2 e.g. $location1 and $location2 so I can then use print to show these values. If there is no LOCATION2 the value of LOCATION2 should not be set, so I can check for this.
The reason I want this is because I am creating automatic meta titles and descriptions for pages that don't have them (i.e. some 45,000).
If there is a space in the URL that uses %20 I need it to be stripped out so I can just print the variable with actually printing the %20 bit.
You don't need to write the bit that creates the meta titles etc. You just need to write a bit of php that parses the URL and returns LOCATION1 as a variable and LOCATION2 if it exists, or don't set LOCATION2 if it doesn't, and make sure the spaces are handled properly so I can just print the variables.
Hope that makes sense!
Extra notes:
Description of requirements/features: In a section of my website, my URLs are formatted like this:
http://www.angeloffices.com/index.php/city/LOCATION1/LOCATION2
For example:
http://www.angeloffices.com/index.php/city/Godstone/Surrey
The bit that always stays the same is http://www.angeloffices.com/index.php/city/
But some URLS only have one location rather than two, like this:
http://www.angeloffices.com/index.php/city/bristol
Some URLS have spaces in the place names which are handled like this:
http://www.angeloffices.com/index.php/city/Aztec%20West/Bristol
I would like a little php script that parses the URL and creates two variables from LOCATION1 and LOCATION2 e.g. $location1 and $location2 so I can then use print to show these values. If there is no LOCATION2 the value of LOCATION2 should not be set, so I can check for this.
The reason I want this is because I am creating automatic meta titles and descriptions for pages that don't have them (i.e. some 45,000).
If there is a space in the URL that uses %20 I need it to be stripped out so I can just print the variable with actually printing the %20 bit.
You don't need to write the bit that creates the meta titles etc. You just need to write a bit of php that parses the URL and returns LOCATION1 as a variable and LOCATION2 if it exists, or don't set LOCATION2 if it doesn't, and make sure the spaces are handled properly so I can just print the variables.
Hope that makes sense!
Extra notes:
Projects Completed
37
Freelancers worked with
29
Projects awarded
50%
Last project
27 Jun 2026
United Kingdom
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies