Title: Coding help
Last modified: August 22, 2016

---

# Coding help

 *  [briansellers](https://wordpress.org/support/users/briansellers/)
 * (@briansellers)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/coding-help-11/)
 * I’m not really sure what to look for here but, I have a problem getting updates
   from a supplier. They allow API calls using XML but I don’t know how or where
   to put the code to get the file or update inventory. Below is a xml code provided
   by the supplier. I was thinking if I built a separate page with a button on it
   that generated the call (POST command) then I could make that page private and
   would be able to get the data then upload to the products to update the products.
   I placed this request in this forum because there may already be an extension
   or add on out there that has these functions but I don’t know if there is. Any
   ones help would be greatly appreciated because at this point, I can’t update 
   inventory.
 * The XML document you will send will resemble the following:
 * <?xml version=”1.0″ encoding=”utf-8″ ?> <inventory><ctid>5B15B4E19BAD45B7920ACB4A4064F234
   </ctid>
    <!–the following “itemlist” container is *OPTIONAL*If you provide an“
   itemlist”, then server will return only the items you requested, otherwise we
   will return all active items in our database (about 1MB response file).If you
   specify invalid item ID’s, they will be ignored. –> <itemlist> <item prodid=”
   AA02″ /> <item prodid=”ACXR410″ /> <item prodid=”AS1″ /> </itemlist> </inventory
   >
 * If there is no error, the server will respond with an inventory document similar
   to the following:
    <?xml version=”1.0″ encoding=”utf-8″ ?> <inventory> <itemlist
   > <item prodid=”AA02″ quantity=”42″ price=”1.16″ map=”0.0″ mfgitem=”AA02″ mfgname
   =”MAPLE LEAF PRESS INC” /> <item prodid=”ACXR410″ quantity=”0″ price=”321.91″
   map=”379.99″ mfgitem=”775011″ mfgname=”EASTON TECHNICAL PRODUCTS” /> <item prodid
   =”AS1″ quantity=”6″ price=”10.67″ map=”13.99″ mfgitem=”MBC SOX LOW S” mfgname
   =”TEAM J SALES AND MARKETIN” /> </itemlist> </inventory>
 * Example of an error:
 * <?xml version=”1.0″ encoding=”utf-8″ ?>
    <error> <timestamp>20080101120101</timestamp
   > <errorid>-20002</errorid> <errordata>This is your error information</errordata
   > </error>
 * I have even tried to send this using POSTMAN but was unsuccessful, I believe 
   because of the https: and the certificate.. Again, any help at all will be greatly
   appreciated. My coding skills are no where near where they need to be for this.

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [shadez](https://wordpress.org/support/users/shadez/)
 * (@shadez)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/coding-help-11/#post-5779310)
 * Woocommerce right? Woocommerce is csv friendly so maybe convert it?
    > [http://www.luxonsoftware.com/Converter/XmlToCsv](http://www.luxonsoftware.com/Converter/XmlToCsv)
 * And/or use some plugin to import:
    > [https://wordpress.org/plugins/woocommerce-csvimport/](https://wordpress.org/plugins/woocommerce-csvimport/)
   > [https://wordpress.org/plugins/woocommerce-xml-csv-product-import/](https://wordpress.org/plugins/woocommerce-xml-csv-product-import/)
   > this looks like paid but good: [http://www.wpallimport.com/](http://www.wpallimport.com/)
 * I havent tried any of these plugins myself. just giving ideas. Hope this helps.
 *  Thread Starter [briansellers](https://wordpress.org/support/users/briansellers/)
 * (@briansellers)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/coding-help-11/#post-5779378)
 * I am currently using WP all Imports which can import CSV but my problem is actually
   sending and getting the response. I don’t know where or how to do it.
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/coding-help-11/#post-5779418)
 * You can send a POST API request using cURL if it is installed on your server.
   To confirm, place `<?php phpinfo();` on a new PHP file and upload to your server.
   Request that page from your browser. Find the “CURL” entry in the response and
   confirm “cURL support” is listed as “enabled”. Remove the file when you’re done,
   it’s a slight security risk.
 * If that checks out, this will help you setup the request: [http://stackoverflow.com/questions/18697422/send-xml-data-to-webservice-using-php-curl](http://stackoverflow.com/questions/18697422/send-xml-data-to-webservice-using-php-curl)
 * If you don’t have cURL available, there’s other options, try searching for the
   stackoverflow post title without the “curl”. Search the entire Internet, not 
   just stackoverflow.
 * You can update inventory with a separate page as you suggest, as long as it is
   using a custom template to contain the requisite code. You’re better off adding
   a admin page using `add_menu_page()` IMO.
 * Is that `<ctid>` code a generic sample ID provided by the supplier? Or is it 
   the ID code assigned to you? If it’s yours, you’ll need to change it ASAP as 
   the entire world now has it.
 *  Thread Starter [briansellers](https://wordpress.org/support/users/briansellers/)
 * (@briansellers)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/coding-help-11/#post-5779423)
 * Thanks – I will try it. Everything on here is sample provided by the supplier
   and won’t work. I actually only understood about half of what you put in your
   response – So if I just create a file called anything.php and then request that
   file then it will send? How does it know where the response comes?
 * I created a testing.php file and put the <?php phpinfo() in it but got a 404 
   error when I put the location in the first time. The second time I got an Internal
   Server Error seen below
 * The server encountered an internal error or misconfiguration and was unable to
   complete your request.
    Please contact the server administrator, and inform them
   of the time the error occurred, and anything you might have done that may have
   caused the error. More information about this error may be available in the server
   error log.
 *  [shadez](https://wordpress.org/support/users/shadez/)
 * (@shadez)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/coding-help-11/#post-5779481)
 * server errors could be htaccess issue etc. for workaround, try creating a page
   template in your current theme directory say anything.php with content:
 *     ```
       <?php
       /** Template Name: Check cURL
       **/
       phpinfo(); ?>
       ```
   
 * .
    create new page and choose this template from right side and then publish/
   preview and check. ofcourse delete it later.
 * PS:
    checked with WP all imports support team for any help? any relevance here?–
   [http://xml-import.eu/datafeed-synchronization-module/](http://xml-import.eu/datafeed-synchronization-module/)
 *  Thread Starter [briansellers](https://wordpress.org/support/users/briansellers/)
 * (@briansellers)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/coding-help-11/#post-5779483)
 * That worked – below is my results about Curl
 * cURL support enabled
    cURL Information 7.22.0 Age 3 Features AsynchDNS No Debug
   No GSS-Negotiate Yes IDN Yes IPv6 Yes Largefile Yes NTLM Yes SPNEGO No SSL Yes
   SSPI No krb4 No libz Yes CharConv No Protocols dict, file, ftp, ftps, gopher,
   http, https, imap, imaps, ldap, pop3, pop3s, rtmp, rtsp, smtp, smtps, telnet,
   tftp Host i686-pc-linux-gnu SSL Version OpenSSL/1.0.1 ZLib Version 1.2.3.4
 * I also contacted WP All Imports and the other link you provided just in case 
   they have some off the shelf things they can provide me too! Thanks so much for
   your help/guidance so far..

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Coding help’ is closed to new replies.

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 6 replies
 * 3 participants
 * Last reply from: [briansellers](https://wordpress.org/support/users/briansellers/)
 * Last activity: [11 years, 3 months ago](https://wordpress.org/support/topic/coding-help-11/#post-5779483)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
