Unable to use php simplexml because of API changes

,

I have my own domain and had been using this resource on Github as the foundation for years: https://github.com/spreadshirt/shoppartnerdemos/tree/master/basketcreation.

It allowed me to fetch product and article information to populate the pages of my website using simplexml. Now with the changes to the API requiring an API key for everything, my entire site is broken.

Every product page gives an 500 error because namespaces can’t work anymore with the api key rquirement.

I’m a self-taught PHP novice. I only knew as much as I needed to get my site working. I have no idea where to begin to fix this.

Hi,

it should be better to use a plugin like WP-Spreadplugin or the Spreadshop. If you really don’t want it, this will help you:

As an extract, you need to provide api key, api secret and user agent to create a basket. I’m not 100% sure if you also need a valid token, as personally, I’m always using it :slight_smile:

Cheers
Thimo

Thank you. I have looked through all those threads and still don’t really know where to start. Some of them aren’t in my native language (English) and in the ones I could read, they didn’t seem to be specific to my setup.

As an extract, you need to provide api key, api secret and user agent to
create a basket. I’m not 100% sure if you also need a valid token, as
personally, I’m always using it

I do use an api key and secret key as shown on the ‘index.php’ page of the Github resource (https://github.com/spreadshirt/shoppartnerdemos/blob/master/basketcreation/index.php). However, I don’t think a user agent or token are included in that particular resource.

Where and how would I add them? And if I add them, will it allow me to use my simplexml commands as they are? Thanks.

I’d recommend you to have a look at the sources state in the links I sent to you (they are in english :wink: ).

If you do

$user_agent = 'my-siteProduct/1.0 (http://www.my-site.fr; mail@test.fr)';
@ini_set ('user_agent', $user_agent);

even simplexml should use your defined useragent.

Otherwise use CURL, provide a user agent, session,… and then read the result with simplexml. But this is all in the links, I just posted before :slight_smile:

Best
Thimo

I’ve been tinkering around with this and I still can’t seem to get it. Using the links and pastebins I still cannot figure out how to make simplexml_load_file work.
Maybe I’m missing it, but I don’t see an example on how to make this specific function work with the API changes. Thanks.

Well, if those won’t help you any further, then we should have a look at your code directly. Will you provide it? You can even message me, if you won’t do it public.

I’m trying to send it private but it says I cannot message you.

I did send a message to you, maybe you can respond :slight_smile: