Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Sep 2008
    Thanked 0 Times in 0 Posts

    Is this possible?

    I've got a used car website, and I'm working on importing XML listing feeds automatically using cron jobs (pardon me if my use of terminology is a bit off... I'm new to this XML and cron job stuff). The problem is, many of the services that compile feeds for local dealers send out their listings in TXT format. They can do XML, but it comes at an additional cost.

    Here's the basic format that I'm looking to use:

    		<title>2001 Honda Civic DX-A</title>
    And here's the format that I've gotten from one service...

    16661|"Sunset Motors"|"447 N.Okatie Hwy"|Ridgeland|SC|29936|843-705-5959|4228341|1B3EL46X15N504836|Used|12040|2005|Dodge|"Stratus Sdn"|Sedan|4|"4dr SXT"|Red|Gray|"4 Cylinder Engine"|Gas||A|135065|6995||"Cruise Control,Power Steering,Air Conditioning,Power Driver Mirror,Power Passenger Mirror,Steering wheel controls,Keyless Entry,Tilt Wheel,Alloy Ladder,Alloy Wheels,Auxiliary Power Oulet,Flex Fuel,Sunroof/Moonroof,Fog Lamps,Driver Air Bag,Power Door Locks,Emergency Trunk Release,Vehicle Anti-Theft System,Traction Control,Alarm,Side Air Bag,Passenger Air Bag,Child Safety Lock,Leather Seats,Bucket Seats,Power Driver Seat,Satellite Radio,AM/FM Stereo,CD Changer,CD  Player,Power Windows,Rear Window Defroster"||http://images.v12soft.com/photos/5iOQx7e/4228341/199983_800600.jpg,http://images.v12soft.com/photos/5iOQx7e/4228341/097276_800600.jpg,http://images.v12soft.com/photos/5iOQx7e/4228341/246306_800600.jpg,http://images.v12soft.com/photos/5iOQx7e/4228341/356059_800600.jpg,http://images.v12soft.com/photos/5iOQx7e/4228341/416253_800600.jpg,http://images.v12soft.com/photos/5iOQx7e/4228341/587170_800600.jpg,http://images.v12soft.com/photos/5iOQx7e/4228341/631097_800600.jpg,http://images.v12soft.com/photos/5iOQx7e/4228341/724656_800600.jpg,http://images.v12soft.com/photos/5iOQx7e/4228341/839183_800600.jpg,http://images.v12soft.com/photos/5iOQx7e/4228341/944682_800600.jpg,http://images.v12soft.com/photos/5iOQx7e/4228341/1097494_800600.jpg,http://images.v12soft.com/photos/5iOQx7e/4228341/1184863_800600.jpg
    While I've kind of figured out how to download the TXT file and convert it to an XML document in the format I need using Excel and then import it manually, is there any way to automate this process so that the listings from this TXT document can be converted and imported using a cron job each night? Is that sort of thing possible using a script of some sort? If so, can anyone point me in the right direction to get started?

    Thanks for any advice you guys can offer.

  2. #2
    Join Date
    May 2002
    Hayward, CA
    Thanked 24 Times in 22 Posts
    The answer is yes, there should be ways to do that via a cron job. But you're probably going to need a different set of skills.

    I'd recommend writing a Python script to do the hard work. You'll need four things:
    • Fetch the text file, preferably via FTP (HTTP will work too)
    • Read the contents of the text and parse it
    • Write the output XML to a file
    • Scheduling the cron job to run the Python script

    I wouldn't do it by Excel - that's more work for you and for your computer. Python should be more than capable of that. Perl will also work, as will PHP.
    "The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
    June 30, 2001
    author, ES7-Membrane project (Github Pages site)
    author, Verbosio prototype XML Editor
    author, JavaScript Developer's Dictionary


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts