Jump to content

IeM

Recommended Posts

Prestashop 1.6.0.8

 

Hi,

I need to use the Prestashop webservice via a script 'PrestaShopWebservice.php' to retrieve and update data, though, after a day of bug tracking I found a problem.

 

It turns out that $_SERVER['PHP_AUTH_USER'] is not active on my shared server and it is required for the webservice authentication when accessing it via 'PrestaShopWebservice.php' (very handy script).

 

The script accessing the webservice is in another application that is in a Prestashop subfolder.

 

I found one trick that does activate $_SERVER['PHP_AUTH_USER'] to allow the webservice script to work and is as follows:

 

.htaccess addition

 

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
</IfModule>

 

PHP script

 

list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':' , base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));

 

The problem is with this solution though, is that while the webservice works, when you go to a non home page of Prestashop such as a product page, the page not available page opens and you can not access other pages.

 

Apart from directly accessing the database which I'd rather not do, any ideas on how the get both the webservice script and the shop working at once?

 

Or is there another script that does not require 'PHP_AUTH_USER' to be active?

 

Thanks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...