| | #1 |
| Active Warrior Join Date: 2014
Posts: 90
Thanks: 1
Thanked 3 Times in 3 Posts
|
Ok, so I am getting a feed that has about 2,000 listings on it, it is very important for my business.... I am having to parse out the title of each listing into city and state, as there is actually not a field separate for those 2 items. There is one big problem with the feed however, the feed is not consistent... Sometimes the city is first in the title, and sometimes the state is first in the title... This is making a lot of the 2,000 listings pop up on incorrect city and state pages on my website... can someone help me? how can I fix this? |
| | |
| |
| | #2 |
| Conceited Know-It-All Join Date: 2014 Location: Amurrica
Posts: 952
Thanks: 465
Thanked 1,136 Times in 503 Posts
|
Lots of ways to approach this one. But really, you might want to post this in the "Programming" subforum. Anyway, I'd probably start by doing something like creating an array of states. Then I'd do a search of your city/state field against this list of states. If there's a match, I'd assume that's the state and then I'd assume the rest of the text is the city. If I didn't get a match, I'd flag the record as an error so that I could manually edit it. Something like that at any rate. But anyway, it's impossible to really say without seeing your data or knowing what tool(s)/language(s. you're using. |
| | |
| |
| | #3 |
| Active Warrior Join Date: 2014
Posts: 90
Thanks: 1
Thanked 3 Times in 3 Posts
|
my website is mobilehomesforsale.com Here is the feed im using... https://www.vmfhomes.com/Content/Feeds/rss.xml |
| | |
| |
| | #4 |
| HyperActive Warrior Join Date: 2008 Location: Romania
Posts: 361
Thanks: 6
Thanked 59 Times in 52 Posts
|
As kilgore suggested the best approach is to have an array with state values and do a simple check. If the first item is in array, then it is a state, if not it is a city.
|
|
Automatically add affiliate links in your website content with Auto Affiliate Links | |
| |
| | #5 |
| Active Warrior Join Date: 2014
Posts: 84
Thanks: 5
Thanked 11 Times in 10 Posts
|
Are you sure your code is ok ? I just tried that feed and it looks state is always in first position. Try this [PHP] <?php $xml = simplexml_load_file("https://www.vmfhomes.com/Content/Feeds/rss. - Pastebin.com - it will echo all items where state is not found. |
| |
| | #6 |
| Active Warrior Join Date: 2014
Posts: 90
Thanks: 1
Thanked 3 Times in 3 Posts
|
Hmm... this is all great info.. I am trying to learn as fast as I can, also going to forward this to my developer guy as a lot of this is over my head... However, you can view my state page of Texas for example Mobile Homes For Sale In Texas Scroll down, and you can see that many listings show up in texas that should not be showing up on this state page.... |
| | |
| |
| | #7 | ||
| Bananas are Yellow! Registered Member War Room Member Join Date: 2013 Location: Wyoming, PA, USA
Posts: 1,046
Thanks: 2,549
Thanked 1,600 Times in 928 Posts
Blog Entries: 4 |
| ||
| Put MY voice on YOUR video: AwesomeAmericanAudio.com | |||
| |
| | #8 |
| VIP Warrior War Room Member Join Date: 2006 Location: , , USA.
Posts: 1,795
Thanks: 70
Thanked 287 Times in 259 Posts
|
It seems more like whatever function that is displaying by city doesn't work correctly.
|
| |
| | #9 |
| Active Warrior Join Date: 2014
Posts: 90
Thanks: 1
Thanked 3 Times in 3 Posts
|
The problem is figured out!! i got it guys. Thanks for advice, it actually led me to diagnose the problem and sit my butt down and figure it out... The bad news is it will take me about 6-12 hours to complelely fix ha...
|
| | |
| |
|
| Bookmarks |
| Tags |
| feed, urgent, xml |
| |