Ejemplo n.º 1
0
    curl_setopt($curl, CURLOPT_AUTOREFERER, 1);
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
    curl_setopt($curl, CURLOPT_TIMEOUT, 30);
    curl_setopt($curl, CURLOPT_HEADER, 0);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    $tmpInfo = curl_exec($curl);
    if (curl_errno($curl)) {
        echo 'Errno' . curl_error($curl);
    }
    curl_close($curl);
    return $tmpInfo;
}
$url = "http://page14.auctions.yahoo.co.jp/jp/auction/s470575105";
$data = "";
$result = vpost($url, $data);
preg_match_all("/<dt class=\"ProductDetail__title\">(.*)<\\/dt>/", $result, $matches1);
preg_match_all("/<dd class=\"ProductDetail__description\"><span class=\"ProductDetail__bullet\">:<\\/span>(.*)<\\/dd>/", $result, $matches2);
//preg_match_all("/<div class=\"ProductImage__inner\">\n(.*)\n<\/div>/", $result, $matches3);
//preg_match_all("/<div class=\"ProductImage js-imageGallery js-disabledContextMenu.*>[\n.]*<!-- \/\.ProductImage -->/", $result, $matches3);
$lines = preg_split("/\n/", $result);
$found = false;
$html_images = "";
foreach ($lines as $line) {
    if (!$found && !preg_match("/<div class=\"ProductImage__body js-imageGallery-body\">/", $line)) {
        continue;
    }
    if (preg_match("/ProductImage__footer js-imageGallery-footer/", $line)) {
        break;
    }
    $found = true;
Ejemplo n.º 2
0
        $getCodeUrl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={$appid}&redirect_uri={$jumpUrl}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect";
        header('Location:' . $getCodeUrl);
    } else {
        $code = $_GET['code'];
        $getToken = "https://api.weixin.qq.com/sns/oauth2/access_token?appid={$appid}&secret={$secret}&code={$code}&grant_type=authorization_code";
        $json_token = vpost($getToken);
        $arr_token = json_decode($json_token, true);
        $userinfo = vpost("https://api.weixin.qq.com/sns/userinfo?access_token={$arr_token['access_token']}&openid={$arr_token['openid']}&lang=zh_CN");
        $user = json_decode($userinfo, true);
        $data['action'] = 'saveUser';
        $data['openid'] = $user['openid'];
        $data['nickname'] = $user['nickname'];
        $data['sex'] = $user['sex'];
        $data['province'] = $user['province'];
        $data['city'] = $user['city'];
        $data['country'] = $user['country'];
        $data['headimgurl'] = $user['headimgurl'];
        $data['ip'] = $_SERVER["REMOTE_ADDR"];
        $bj = vpost("{$serverurl}/save.php", $data);
        $ctime = 360000;
        setcookie('openid', $user['openid'], time() + $ctime, '/');
        setcookie('nickname', $user['nickname'], time() + $ctime, '/');
        setcookie('sex', $user['sex'], time() + $ctime, '/');
        setcookie('headimgurl', $user['headimgurl'], time() + $ctime, '/');
        setcookie('status', $result['status'], time() + $ctime, '/');
        setcookie('id', $result['id'], time() + $ctime, '/');
        setcookie('addtime', $time, time() + $ctime, '/');
    }
}
$headimgUrl = $_COOKIE['headimgurl'];
//用户头像