高解像度画像を作成するフラッシュアプリを作成しました。私はphpスクリプトを使ってZenCartにこの画像を製品として追加しようとしています。私はカールで管理者にアクセスし、新しい製品を追加し、成功した場合は新しく作成した製品IDを返すことを考えました。CURL経由でZenCartに製品を動的に追加する
これは、スクリプトのログイン一部のようになります。
$curl = curl_init();
$fields = array('admin_name'=>'user', 'admin_pass'=>'pass');
$url = 'http://www.mystore.com/login.php';
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $fields);
$result = curl_exec($curl);
if(curl_errno($curl)){
echo 'error';
} else {
echo $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.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
私は
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
を使用して試してみました
成功しません。何か案は?
ありがとうございます。