コード例 #1
0
function scrape_items($url, $number)
{
    $active_user = $_SESSION['user_id'];
    $data = postForm($url);
    $html = str_get_html($data);
    //echo $data;die;
    $max = 0;
    if ($number) {
        $max = $number;
    }
    $j = 0;
    foreach ($html->find('div[id=tile-container]') as $bloc) {
        foreach ($bloc->find('div[class=js-tile tile-landscape] a[class=js-product-title]') as $item) {
            $itemlink = $item->href;
            $taburl = explode('/', $itemlink);
            $itemnumber = $taburl[count($taburl) - 1];
            $url = 'http://www.walmart.com/' . $itemlink;
            $data = postForm($url);
            $htmlb = str_get_html($data);
            foreach ($htmlb->find('div[class=product-subhead-section product-subhead-walmartnumber]') as $item) {
                preg_match_all('!\\d+!', $item->plaintext, $matches);
                $itemnumber2 = $matches[0][0];
            }
            //$tab=explode('/',$itemlink);
            //$itemnumber=$tab[count($tab)-1];
            if ($itemnumber != '' && $j < $max) {
                $sql = "INSERT INTO asins_table(asins,UserID,processed,provider) values('" . $itemnumber2 . "'-'" . $itemnumber . "''" . $active_user . "',0,'Walmart')";
                mysql_query($sql) or die(mysql_error());
                $j++;
            }
        }
    }
    return true;
    //return $result;
}
コード例 #2
0
function scrape_asins($url, $number)
{
    $active_user = $_SESSION['user_id'];
    $data = postForm($url);
    $html = str_get_html($data);
    $nb = 0;
    $max = 0;
    if ($number) {
        $max = $number;
    }
    $j = 0;
    foreach ($html->find('div[id=resultsCol]') as $bloc) {
        foreach ($bloc->find('div[class=grid results  cols3]') as $item) {
            foreach ($item->find('div') as $asins) {
                if ($asins->name != '' && $j < $max) {
                    $res = mysql_query("select * from asins_table where asins='" . $asins->name . "' and UserID=" . $active_user . "");
                    if (!mysql_num_rows($res)) {
                        $sql = "INSERT INTO asins_table(asins,UserID,processed,provider) values('" . $asins->name . "'," . $active_user . ",0,'Amazon')";
                        mysql_query($sql) or die(mysql_error());
                    }
                    $j++;
                }
            }
        }
    }
    return true;
    //return $result;
}
コード例 #3
0
function scrape_items($url, $number)
{
    $active_user = $_SESSION['user_id'];
    $data = postForm($url);
    $html = str_get_html($data);
    //echo $data;die;
    $max = 0;
    if ($number) {
        $max = $number;
    }
    $j = 0;
    foreach ($html->find('ul[id=hs-list-items]') as $bloc) {
        foreach ($bloc->find('li div[class=img] a') as $item) {
            $url = $item->href;
            $tmp = explode('/', $url);
            $itemn = $tmp[count($tmp) - 1];
            preg_match_all('!\\d+!', $itemn, $matches);
            $itemnumber = $matches[0][0];
            if ($itemnumber != '' && $j < $max) {
                $sql = "INSERT INTO asins_table(asins,UserID,processed,provider) values('" . $itemnumber . "'," . $active_user . ",0,'Aliexpress')";
                mysql_query($sql) or die(mysql_error());
                $j++;
            }
        }
    }
    foreach ($html->find('div[id=hs-below-list-items]') as $bloc) {
        foreach ($bloc->find('li div[class=img] a') as $item) {
            $url = $item->href;
            $tmp = explode('/', $url);
            $itemn = $tmp[count($tmp) - 1];
            preg_match_all('!\\d+!', $itemn, $matches);
            $itemnumber = $matches[0][0];
            if ($itemnumber != '' && $j < $max) {
                $sql = "INSERT INTO asins_table(asins,UserID,processed,provider) values('" . $itemnumber . "'," . $active_user . ",0,'Aliexpress')";
                mysql_query($sql) or die(mysql_error());
                $j++;
            }
        }
    }
    return true;
    //return $result;
}
コード例 #4
0
ファイル: UTP-listaCurso.php プロジェクト: ranmadxs/dorcl
include_once '../PHPCriteria/Criteria.php';
include_once '../PHPCriteria/criterion/Restrictions.php';
include_once '../PHPCriteria/criterion/Order.php';
$smarty = new Smarty();
smartyTemplate($smarty, "../");
require_once '../phpLib/SmartyToolbox.php';
$criteria = new Criteria();
$curso = $_GET['curso'];
$alumno = new EntityAlumnos();
$alumno->curso = $curso;
if (isset($_GET['exito']) && !isset($_POST['guardar']) && !isset($_POST['buscar'])) {
    if ($_GET['exito'] == "exito") {
        $smarty->assign("exito", "La Lista del curso ha sido guardada exitosamente");
    }
}
if (isset($_POST['guardar']) && postForm($_POST['postID'])) {
    if ($_POST['guardar'] == "guardar_lista") {
        $i = 1;
        foreach ($_POST['alumnos'] as $key => $rutAlumno) {
            $alumnoGuardar = new EntityAlumnos();
            $alumnoGuardar->rut = $rutAlumno;
            $criteria->find($alumnoGuardar);
            $alumnoGuardar->lista = $i++;
            $criteria->merge($alumnoGuardar);
        }
        moveLocationFast("UTP-listaCurso.php?curso=" . $curso . "&exito=exito");
    }
}
$orden_alfabetico = false;
if (isset($_POST['buscar'])) {
    if ($_POST['buscar'] == "orden_alfabetico") {
コード例 #5
0
<?php

session_start();
include "simple_html_dom.php";
include 'inc.db.php';
$active_user = $_SESSION['user_id'];
$itemnumber2 = $_POST['itemnumber'];
$url = "http://www.walmart.com/search/?query=" . $itemnumber2;
$data = postForm($url);
$html = str_get_html($data);
//echo $data;die;
foreach ($html->find('div[id=tile-container]') as $bloc) {
    foreach ($bloc->find('div[class=js-tile tile-landscape] a[class=js-product-title]') as $item) {
        $itemlink = $item->href;
        $taburl = explode('/', $itemlink);
        $itemnumber = $taburl[count($taburl) - 1];
        $res = mysql_query("select * from asins_table where asins='" . $itemnumber2 . "'-'" . $itemnumber . "' and UserID=" . $active_user . "");
        if (!mysql_num_rows($res)) {
            $sql = "INSERT INTO asins_table(asins,UserID,processed,provider) values('{$itemnumber2}-{$itemnumber}'," . $active_user . ",0,'Walmart')";
            mysql_query($sql);
            $result = array("state" => "Ok", "data" => "");
            echo json_encode($result);
        } else {
            $result = array("state" => "error", "data" => "Product already exist in the list");
            echo json_encode($result);
            exit(200);
        }
    }
}
function postForm($url)
{
コード例 #6
0
function scrap_walmartlink($itemid)
{
    $url = "http://www.walmart.com/search/search-ng.do?search_query=" . $itemid;
    $data = postForm($url);
    $link = "";
    //echo $data;die;
    $html = str_get_html($data);
    if ($html) {
        foreach ($html->find('a[class=js-product-title]') as $title) {
            $link = $title->href;
            break;
        }
    }
    return $link;
}
コード例 #7
0
ファイル: adminlogin.php プロジェクト: phpscr/baibaiba
require_once "config_visible.php";
function postForm($url)
{
    $md5 = new MD5();
    ?>
	<meta charset="utf-8">
	管理员登陆,请勿泄漏!!!
	<form name="loginform" method="POST" action='<?php 
    echo $url;
    ?>
' class="aui login-form-container">                                     
	    用户名<input name="os_username" id="os_username" value="admin" type="text">      
	    密码<input name="os_password" id="os_password" value="" type="password" style="">                 
	    <input id="loginButton" class="aui-button aui-style aui-button-primary" name="login" value="登录" type="submit" style="">                                                         
	    <input name="os_destination" value="" type="hidden">                                      
	</form>
	<?php 
}
if (isset($_GET["target"])) {
    if ($_GET["target"] == "mobo_confluence") {
        postForm(URL_MOBO_CONFLUENCE);
    } else {
        header("Location: home.php");
    }
} else {
    header("Location: 404page.php");
}
?>


コード例 #8
0
    curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt");
    curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt");
    curl_setopt($ch, CURLOPT_AUTOREFERER, true);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_URL, $url);
    $data = curl_exec($ch);
    curl_close($ch);
    return $data;
}
//include 'inc.db.php';
ini_set('display_errors', 1);
ignore_user_abort(true);
error_reporting(E_ALL);
set_time_limit(0);
ini_set("memory_limit", "-1");
$i = 1;
while (true) {
    $url = "http://www.amazon.com/Best-Sellers-Kitchen-Dining/zgbs/kitchen/ref=zg_bs_unv_k_1_289668_1&pg=" . $i;
    echo $url . '<br>';
    $html = postForm($url);
    preg_match_all('/(<div class="zg_title">)([^`]*?)<\\/div>/', $html, $match);
    foreach ($match[2] as $top) {
        preg_match('/(dp\\/)([^`]*?)(\\/ref)/', $top, $match);
        print $match[2] . "<br/>";
    }
    $i++;
    if ($i == 6) {
        break;
    }
}
コード例 #9
0
ファイル: UTP-nuevoRamo.php プロジェクト: ranmadxs/dorcl
$smarty = new Smarty();
smartyTemplate($smarty, "../");
$class_ramo = new ramo();
$areas = $class_ramo->obtenerAreas();
$tipos = $class_ramo->obtenerTipos();
$class_personas = new Personas();
$curso = $_GET["curso"];
$colegio_ID = $_SESSION["colegio"]->colegio_ID;
$mostrac_curso = "";
if (str_word_count($curso) == 0) {
    $smarty->assign("error", "Debe tener seleccionado un curso");
} else {
    $mostrar_curso = mostrar_curso($curso);
    $personas = $class_personas->listaPersonal($colegio_ID, "docente");
}
if (postForm($_POST['postID']) && $_POST['postID'] > 0) {
    $ramo = PHPBind::post(new EntityRamos());
    $persona = new EntityPersonas();
    if (!($ramo->profesor > 0)) {
        $smarty->assign("error", "Debe seleccionar un profesor");
    } else {
        $persona->per_ID = $ramo->profesor;
        $persona = $class_personas->buscarPersona($persona);
        $ramo->profesor = $persona->per_nombres . " " . $persona->per_apellidop . " " . $persona->per_apellidom;
        $criteria->persist($ramo);
        $smarty->assign("exito", "El ramo ha sido creado exitosamente");
    }
}
$num = $class_ramo->lastNum($curso);
$smarty->assign("personas", $personas);
$smarty->assign("num", $num);
コード例 #10
0
function scrape_asins($asin)
{
    $result = array();
    $url = "http://www.amazon.com/dp/" . $asin;
    $data = postForm($url);
    //echo $data;die;
    $html = str_get_html($data);
    foreach ($html->find('h1[id=title] span[id=productTitle]') as $title) {
        $result['title'] = $title->plaintext;
        break;
    }
    //echo $result['title'];die;
    $result['asin'] = $asin;
    $result['description'] = "";
    $htmldesc = file_get_html($url);
    foreach ($htmldesc->find('div[class=productDescriptionWrapper]') as $description) {
        $result['description'] = $description->plaintext;
        break;
    }
    $result['brand'] = "";
    foreach ($html->find('a[id=brand]') as $brand) {
        $result['brand'] = $brand->plaintext;
        break;
    }
    $result['features'] = "";
    foreach ($html->find('div[id=feature-bullets] ul[class=a-vertical a-spacing-none]') as $features) {
        foreach ($features->find('li span') as $features_lines) {
            $result['features'] .= '<li>' . $features_lines->plaintext . '</li>';
        }
        break;
    }
    $result['imageurl'] = "";
    foreach ($html->find('div[id=imgTagWrapperId] img') as $image) {
        $result['imageurl'] = $image->src;
        break;
    }
    $result['imageurl'] = str_replace("._SY300_", "", $result['imageurl']);
    $size = getimagesize($result['imageurl']);
    $height = $size[1];
    $width = $size[0];
    if ($size[1] < 500) {
        $diff = 500 - $size[1];
        $height = $size[1] + $diff;
        $width = $size[0] + $diff;
    }
    $url = $result['imageurl'];
    $extension_upload = strtolower(substr(strrchr($result['imageurl'], '.'), 1));
    $savedpict = 'uploads/amazon/' . $asin . '.' . $extension_upload;
    touch($savedpict);
    chmod($savedpict, 0777);
    $img = $savedpict;
    file_put_contents($img, file_get_contents($url));
    /* $thumb = new Imagick($img);
         
    $thumb->resizeImage(800,800,Imagick::FILTER_LANCZOS,1);
    
    $thumb->writeImage($img);
    
    $thumb->destroy();*/
    smart_resize_image($img, null, $width, $height, false, $img, false, false, 100);
    $result['imageurl'] = 'http://ezon.org/cl/ezonlister/' . $img;
    //http://ecx.images-amazon.com/images/I/61bfvPIbrdL._SX700_.jpg
    //$result['imageurl']=str_replace('SY300','SS700',$result['imageurl']);
    //echo $result['imageurl'];die;
    $result['listprice'] = "";
    foreach ($html->find('div[id=price] table[class=a-lineitem] td[class=a-span12 a-color-secondary a-size-base a-text-strike]') as $listprice) {
        $result['listprice'] = $listprice->plaintext;
        break;
    }
    $url = "http://www.amazon.com/gp/offer-listing/" . $asin . "/ref=dp_olp_new?ie=UTF8&condition=new";
    $data = postForm($url);
    $htmloffer = str_get_html($data);
    $result['offerprice'] = "";
    $result['prime'] = "";
    $prime = 0;
    $etat = 0;
    foreach ($htmloffer->find('div[class=a-section a-spacing-double-large]') as $html1) {
        foreach ($html1->find('div[class=a-row a-spacing-mini olpOffer]') as $html2) {
            foreach ($html2->find('div[class=a-column a-span2]') as $html3) {
                foreach ($html3->find('span[class=a-size-large a-color-price olpOfferPrice a-text-bold]') as $html4) {
                    $price = $html4->plaintext;
                }
                foreach ($html3->find('span[class=supersaver]') as $html6) {
                    $etat++;
                    $prime = 1;
                    if ($etat <= 1) {
                        $lowestprice = $price;
                    }
                }
            }
        }
    }
    $result['offerprice'] = $price;
    if ($prime > 0) {
        $result['offerprice'] = $lowestprice;
        $result['prime'] = 'Yes';
    }
    $result['quantity'] = "";
    $qte = 0;
    foreach ($html->find('select[id=quantity]') as $quantity) {
        foreach ($quantity->find('option') as $opt) {
            $qte++;
        }
    }
    $result['quantity'] = $qte;
    $result['shippingprice'] = "";
    foreach ($html->find('div[id=price] table[class=a-lineitem] tr td[class=a-span12] span[id=ourprice_shippingmessage] span[class=a-size-base a-color-secondary]') as $shippingprice) {
        $result['shippingprice'] = $shippingprice->plaintext;
        break;
    }
    $result['weight'] = "";
    foreach ($html->find('div[id=detail-bullets] td[class=bucket] div[class=content] ul') as $details) {
        foreach ($details->find('li') as $weight) {
            if (strpos($weight->plaintext, 'Weight')) {
                $result['weight'] = $weight->plaintext;
                break;
            }
        }
    }
    $str = $result['weight'];
    preg_match_all('!\\d+!', $str, $matches);
    $pos1 = strpos($result['weight'], $matches[0][0]);
    $pos2 = strpos($result['weight'], '(');
    $pound = substr($result['weight'], $pos1 + strlen($matches[0][0]), $pos2 - 18);
    $result['weight'] = $matches[0][0] . ' ' . $pound;
    $result['dimension'] = "";
    foreach ($html->find('div[id=detail-bullets] td[class=bucket] div[class=content] ul') as $details) {
        foreach ($details->find('li') as $dimension) {
            if (strpos($dimension->plaintext, 'Dimensions')) {
                $result['dimension'] = $dimension->plaintext;
                break;
            }
        }
    }
    $pos1 = strpos($result['dimension'], ':');
    //$pos2=strpos($result['dimension'],'inches');
    $dimension = substr($result['dimension'], $pos1 + 1, strlen($result['dimension']));
    $dimension = str_replace('inches', '', $dimension);
    $result['dimension'] = $dimension;
    $result['mpn'] = "";
    foreach ($html->find('div[id=detail-bullets] td[class=bucket] div[class=content] ul') as $details) {
        foreach ($details->find('li') as $mpn) {
            if (strpos($mpn->plaintext, 'model')) {
                $result['mpn'] = $mpn->plaintext;
                break;
            }
        }
    }
    $pos1 = strpos($result['mpn'], ':');
    $mpn = substr($result['mpn'], $pos1 + 1, strlen($result['mpn']));
    $result['mpn'] = $mpn;
    $i = 0;
    $result['pictures'] = "";
    $pictures = array();
    foreach ($html->find('div[id=altImages] ul') as $blocthumb) {
        foreach ($blocthumb->find('li img') as $liimg) {
            $result['pictures' . $i] = $liimg->src;
            $result['pictures' . $i] = str_replace('SS40', 'SS400', $result['pictures' . $i]);
            $i++;
        }
    }
    $j = 0;
    while (isset($result['pictures' . $j])) {
        $pictures[] = $result['pictures' . $j];
        $j++;
    }
    $thumbpictures = "";
    if (count($pictures) > 0) {
        $thumbpictures = implode(',', $pictures);
    }
    $result['pictures'] = $thumbpictures;
    return $result;
}
コード例 #11
0
require "../main_Lib.php";
include_once '../class/class_curso.php';
include_once '../class/class_alumno.php';
include_once '../phpLib/PHPBind.php';
validarAcceso(AuthUser::TIPO_TODOS);
require_once '../class/class_observaciones.php';
include_once '../bean/EntityObservaciones_alumnos.php';
require "../smartyLib/Smarty.class.php";
$smarty = new Smarty();
smartyTemplate($smarty, "../");
$class_curso = new curso();
$class_alumno = new alumno();
$curso = $_POST['curso'];
$periodo = $_POST['periodo'];
$criteria = new Criteria(BD_SIGA);
if (isset($_POST) && isset($_POST['guardar_obs']) && isset($_POST['observaciones']) && is_array($_POST['observaciones']) && postForm($_POST['postID'])) {
    $observaciones = $_POST['observaciones'];
    foreach ($observaciones as $rut => $observacion) {
        $observacionesAlumnos = new EntityObservaciones_alumnos();
        $observacionesAlumnos->FK_alumnos_rut = $rut;
        $observacionesAlumnos->FK_colegio_ID = $_SESSION['base_datos']->bd;
        $observacionesAlumnos->anio = $_SESSION['base_datos']->anio;
        $observacionesAlumnos->periodo = $periodo;
        $observacionesAlumnos->observacion = $observacion["observacion"];
        $observacionesAlumnos->id = $observacion["id"];
        if ($observacionesAlumnos->id > 0) {
            $criteria->merge($observacionesAlumnos);
        } else {
            $criteria->persist($observacionesAlumnos);
        }
    }
コード例 #12
0
ファイル: index.php プロジェクト: splitbrain/WePing
    <link rel="stylesheet" type="text/css" href="style.css" />
    <script language="JavaScript" type="text/javascript" src="script.js"></script>
    <link rel="shortcut icon" type="image/png" href="weping.png" />
</head>
<body>
    <div class="wrap">
        <h1 id="popup"><?php 
echo htmlspecialchars($CONF['title']);
?>
</h1>
        <?php 
post();
?>

        <?php 
postForm();
?>
        <?php 
flush();
ob_flush();
?>

        <?php 
getLatest();
?>

        <span id="login">/<?php 
echo htmlspecialchars($LOGIN);
?>
</span>
        <a class="foot" href="http://github.com/splitbrain/WePing">WePing</a>
コード例 #13
0
ファイル: post.php プロジェクト: phpscr/baibaiba
        header("Location: 404page.php");
    }
}
if (isset($_GET["target"])) {
    if ($_GET["target"] == "mobo_confluence") {
        //confluence跳转
        postForm(URL_MOBO_CONFLUENCE);
    } elseif ($_GET["target"] == "mobo_jira") {
        //jira跳转
        postForm(URL_MOBO_JIRA);
    } elseif ($_GET["target"] == "mobo_testlink") {
        //testlink跳转
        postForm(URL_MOBO_TESTLINK);
    } elseif ($_GET["target"] == "mobo_jenkins") {
        //jenkins跳转
        postForm(URL_MOBO_JINKENS);
    } elseif ($_GET["target"] == "mobo_scanapps") {
        //scanapps跳转
        postForm(URL_MOBO_SACNAPPS);
    } else {
        header("Location: home.php");
    }
} else {
    header("Location: 404page.php");
}
?>
<script>
window.onload=function(){document.loginform.submit();}
</script>

コード例 #14
0
function scrap_aliexpress($itemid)
{
    $result = array();
    $url = "http://www.aliexpress.com/wholesale?SearchText=" . $itemid;
    //echo $url;
    $data = postForm($url);
    //echo $data;die;
    $html = str_get_html($data);
    $result['itemid'] = $itemid;
    preg_match("|<span.*?itemprop=\"price\".*?>(.*?)</span>|s", $html, $match_item_price);
    if (isset($match_item_price[1])) {
        $item_price = $match_item_price[1];
    }
    $result['offerprice'] = $item_price;
    $offerprice = explode('-', trim($result['offerprice']));
    $result['offerprice'] = '$' . $offerprice[0];
    $qte = 0;
    foreach ($html->find('dl[id=product-info-quantity] input[id=product-info-txt-quantity]') as $quantity) {
        $qte = intval($quantity->value);
        break;
    }
    if ($qte > 0) {
        $result['quantity'] = $qte;
    } else {
        $result['quantity'] = 1;
    }
    $result['prime'] = 'Yes';
    return $result;
}
コード例 #15
-1
function scrape_items($url, $number)
{
    $active_user = $_SESSION['user_id'];
    $data = postForm($url);
    $html = str_get_html($data);
    //echo $data;die;
    $max = 0;
    if ($number) {
        $max = $number;
    }
    $j = 0;
    foreach ($html->find('ul[id=result-products]') as $bloc) {
        foreach ($bloc->find('li[class=product] a[class=pro-thumb]') as $item) {
            $url = $item->href;
            $dataitem = postForm($url);
            $htmlitem = str_get_html($dataitem);
            foreach ($htmlitem->find('span[id=itmNum]') as $itemnumber) {
                $tmp = $itemnumber->plaintext;
                preg_match_all('!\\d+!', $tmp, $matches);
                $itemnumber = $matches[0][0];
                if ($itemnumber != '' && $j < $max) {
                    $sql = "INSERT INTO asins_table(asins,UserID,processed,provider) values('" . $itemnumber . "'," . $active_user . ",0,'Overstock')";
                    mysql_query($sql) or die(mysql_error());
                    $j++;
                }
            }
        }
    }
    return true;
    //return $result;
}