We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42596
    • 45 Posts
    Hi guys,

    Apologies if this has been asked before but I found it very difficult to search and get the results of what I needed. If it has been asked before I do apologize...feel free to link to that post but I could not find anything.

    Anyway...I am building a website for a car dealership. They have found a service where they can upload all the info about the car and then it automatically gets posted socially as well as to a new zealand version of ebay and a couple other auto trading websites.

    The client would like to add the modx website I have made for them to that list of websites that gets auto posted to so that they just have to add the car information once and it basically gets posted everywhere including their own website.

    I have been a web dev for a while now and not scared of a bit of php I have just never done anything like this before...Ihave only worked the other way around where they might enter information into the modx website and then that posts to other sites automatically.

    So my question I guess is...where do I start?

    The website they will post to is called motorcentral.co.nz

    They have sent a demo xml file which I guess they would send to my modx website everytime the customer adds a new car...I'm just not too sure how to constantly listen for any data they might send me and then add that as a new resource (currently on the website each car is its own resource).

    Also apologies if this is written in the wrong place...mods please feel free to move this thread if it is in the wrong place.

    Many thanks in advance!

    Matt [ed. note: cleanboy last edited this post 10 years, 4 months ago.]
      • 3749
      • 24,544 Posts
      If they will send it to a particular URL on your site, you can put a snippet on that page that parses the data and does something with it. Start with this snippet on the page:

      [[!GetPost]]

      <?php
      /* GetPost snippet */
      
      $modx->log(modX::LOG_LEVEL_ERROR, '<pre>' . print_r($_POST, true) . '</pre>');
      


      That should put the XML in the MODX Error Log (the pre tags may not be necessary).

      Hopefully, there's a way to tell if the XML is really coming from them. Otherwise, you'll have a serious security vulnerability. You'll also want to sanitize the $_POST values before doing anything with them.




        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting