Americanapparel.class.php
784 Bytes
<?php
/**
* http://store.americanapparel.net(国外)处理时间:4-6s
*
*/
class Util_Product_Api_Americanapparel extends Util_Product_Api
{
public function getData($url)
{
$data = Util_Product_ApiConnect::get($url, array(CURLOPT_TIMEOUT_MS => 8000));
if(!empty($data))
{
@phpQuery::newDocument($data);
self::$product->name = pq('.productDetailsTopBar')->find('h1')->text();
self::$product->img = trim(pq('#zoom1')->find('img')->attr('src'));
self::$product->price = str_ireplace('$','',trim(pq('#skuPriceId')->text()));
self::$product->unit = 'USD';
}
else
{
throw new Util_Product_ApiException('请输入正确的商品地址!');
}
}
}