Automatic XML Upload - dbmake.cgi will not authenticate

General ShopSite user discussion

Automatic XML Upload - dbmake.cgi will not authenticate

Postby kyleh » Tue Aug 03, 2010 12:31 pm

I'm having trouble getting dbmake.cgi to authenticate in anything other than a browser - which is great but defeats the purpose of automation. All the code lives on the same server as the ShopSite installation.

In my code I use Curl to call dbupload.cgi which authenticates fine and returns a link to the dbmake.cgi url but when I tell Curl to use UNRESTRICTED_AUTH and FOLLOWLOCATION I keep getting a 401 Authorization Required. This seems like strange behavior because dbupload.cgi also requires authentication and works fine.

Code: Select all
    $url = 'http://mydomain.com/cgi-bin/ss/dbupload.cgi?clientApp=1&dbname=pages&filename=sample2.xml&uniqueName=File+Name';
    $eld_user = 'my_shopsite_user';
    $eld_pw = 'my_shopsite_pw';
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url); #input
    curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY );
    curl_setopt($ch, CURLOPT_USERPWD, "{$eld_user}:{$eld_pw}");
    curl_setopt($ch, CURLOPT_UNRESTRICTED_AUTH, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $info = curl_getinfo($ch);
    $result = curl_exec($ch);
    curl_close($ch);
    var_dump($result);


Result:
Authorization Required
This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.

I also tried to just Curl the dbmake.cgi like that was generated by dbupload.cgi using authentication and got the same result.

Has anyone else had issues using dbmake.cgi from a script? Any help is much appreciated as I have been stuck on this for a while now.
kyleh
 
Posts: 4
Joined: Tue Aug 03, 2010 12:08 pm
Location: Colorado, USA

Postby jnarayan » Tue Aug 03, 2010 4:16 pm

I know we ran into similar issues while trying the dbupload.cgi script. Stuff related to authentication failure.

We use Python, and if I remember it correctly, we overcame that using urllib2.HTTPPasswordMgrWithDefaultRealm()

I am not a php expert, but I am wondering if this has anything to do with setting the realm. Hope that helps.
Jagath Narayan
Ordoro : Web based order management for Shopsite merchants
www.ordoro.com
jnarayan
 
Posts: 13
Joined: Fri Jul 23, 2010 5:53 am
Location: Austin, TX


Return to User Forum

Who is online

Users browsing this forum: No registered users and 63 guests