function parseDBLine($record)
{
    $dbRecord = array();
    // note that the fields start off at 0, and they are simply parsed
    // in order
    $field = 0;
    print_r("original record");
    print_r($record);
    list($dbRecord["FirstName"], $dbRecord["LastName"]) = parseName($record[$field++]);
    $dbRecord["Email"] = parseEmail($record[$field++]);
    $dbRecord["Phone"] = parsePhone($record[$field++]);
    $dbRecord["Title"] = null;
    $dbRecord["CustomerCNotes"] = parseCustomerCNotes($record[$field++]);
    list($dbRecord["Street1"], $dbRecord["Street2"], $dbRecord["City"], $dbRecord["State"], $dbRecord["Zip"]) = parseAddress($record[$field++]);
    $dbRecord["Country"] = "US";
    $dbRecord["AdminCNotes"] = parseAdminCNotes($record[$field++]);
    $dbRecord["OrderedDate"] = $dbRecord["MetDate"] = parseMetDate($record[$field++]);
    $dbRecord["CustomerONotes"] = parseCustomerONotes($record[$field++]);
    $dbRecord["AdminONotes"] = parseAdminONotes($record[$field++]);
    $dbRecord["Charity"] = parseCharity($record[$field++]);
    $dbRecord["RequestedPay"] = parsePaymentRequested($record[$field++]);
    $dbRecord["PaidDate"] = parsePaid($record[$field++], "10/1/2014");
    $dbRecord["ReleasedToShipping"] = parseReleasedToShipping($record[$field++], "10/1/2014");
    $dbRecord["ShippedDate"] = parseShipped($record[$field++], "10/1/14");
    $dbRecord["IsExpedited"] = parseExpedite($record[$field++]);
    $dbRecord["WasCanceled"] = parseCanceled($record[$field++]);
    $dbRecord["InvoiceNumber"] = $dbRecord["InvoiceID"] = $dbRecord["InvoiceURL"] = null;
    $dbRecord["Carrier"] = $dbRecord["TrackingNum"] = $dbRecord["WasReceived"] = null;
    $dbRecord["Discount"] = $dbRecord["ShippingFee"] = $dbRecord["ExpediteFee"] = null;
    $dbRecord["Products"] = parseProducts($record[$field++]);
    var_dump($dbRecord);
    return $dbRecord;
}
function productsLoaded()
{
    $redo = filter_input(INPUT_POST, "instr");
    if (isset($_SESSION['p_init'])) {
        if ($_SESSION['p_init'] === false || !isset($GLOBALS['cat_array'])) {
            getProducts();
            return;
        }
    } elseif ($redo === "redo" || !isset($GLOBALS['csv_loc'])) {
        getProducts();
        return;
    } else {
        parseProducts();
    }
    echo "Import Complete";
}
Exemple #3
0
    return $exhibitorLink;
}
die;
echo "Start\n";
$exhibitorsLinks = [];
// Initiate the transfers and create a promise
$promise = $pool->promise();
// Force the pool of requests to complete.
$promise->wait();
echo "End\n";
print_r($exhibitorsLinks);
die;
$pool = new Pool($client, $requests($modelsLinks), ['concurrency' => 4, 'fulfilled' => function ($response, $index) {
    global $modelsLinks;
    echo "{$index} loaded\n";
    parseProducts((string) $response->getBody(), $modelsLinks[$index]);
}, 'rejected' => function ($reason, $index) {
    // this is delivered each failed request
    echo "{$index} rejected\n";
}]);
function parseProducts($text, $url)
{
    //echo $text;
    global $html;
    global $productUrls;
    $html->load($text);
    $productsUrls[] = $url;
    foreach ($html->find('a.sidenav') as $sidenav) {
        if (!isset($sidenav->onClick) && $sidenav->href != "#") {
            $productUrls[] = $sidenav->href;
        }