$product_images = $soap->call($session_id, 'catalog_product_attribute_media.list', $product['sku']);
//echo "--".count($product_images)."--";
for($i=0;$i < count($product_images) ;$i++){
unset($product_images[$i]['file']);
$curl = curl_init($product_images[$i]['url']);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, false );
$ret_val = curl_exec($curl);
if(!curl_errno($curl)){
$file = array(
'content' => chunk_split(base64_encode($ret_val)),
'mime' => curl_getinfo($curl , CURLINFO_CONTENT_TYPE),
);
$product_images[$i]['file']=$file;
$result2 = $soap_2->call($session_id_2,"catalog_product_attribute_media.create", array($result, $product_images[$i]));
} else {
print_r(curl_error($curl));
}
curl_close($curl);
}
这是将所有产品从一个磁存储复制到另一个磁存储的代码的一部分。上面的代码复制图像。现在,代码复制了没有图像的所有产品,当我调试找出原因时,我得到了:SSL connect error
我添加了&#34; verify = false&#34;但仍然无法工作,任何人都可以帮忙吗?
答案 0 :(得分:0)
补充:
a[1]
尝试添加此行:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
答案 1 :(得分:0)
我建议使用Magento包装器并尝试使用它:
$curl = new Varien_Http_Adapter_Curl();
$curl->setConfig(array(
'verifypeer' => 0, //this values will be by default, see lib/Varien/Http/Adapter/Curl.php:75
'verifyhost' => 0,
));
$url = "your_url";
$curl->write(Zend_Http_Client::GET, $url, '1.0');
$data = $curl->read()