Jump to content

Recommended Posts

Warning: Invalid argument supplied for foreach() in /home/*/public_html/order/EP_Dev_cPanel_API_PHP4.php on line 497
  Okay...so here's the code 10 lines before and after...
[code]
$this->accountList = $accountList;
}


/**
* Parse fetched account list for domain list, user package list,
* and reseller list.
*/
function parseAccountList()
{
foreach($this->accountList as $reseller => $reseller_data)    LINE ERROR!
{
foreach($reseller_data as $user => $user_data)
{
$this->domainList[$user] = $user_data['domain'];
$this->userPackageList[$user] = $user_data['package'];
$this->resellerList[$reseller][$user] = $user_data['domain'];
}
}
}
[/code]
Link to comment
https://forums.phpfreaks.com/topic/14891-confused-on-this/
Share on other sites

It is my script here's the accountList:
[code] function fetchAccountList()
{
$result = $this->doCommand("/scripts/reslist");

$match = preg_match("/<html>.*?<tr class=\"tblheader\">.*?(<tr class=\"tblheader\">.*?)<\/table><\/html>/is", $result, $matches);

if ($match)
{
$second_matches = explode("<tr class=\"tblheader\">", $matches[1]);

foreach($second_matches as $key => $value)
{
unset($all_matches);

// skip key 0 (empty)
if ($key == 0)
continue;

if (preg_match_all("/.*?<b><u>(.*?)<\/u><\/b>.*?<b>.*?<\/b>.*?<b>(.*?)<\/b>(.*<\/tr>)/is", $value, $all_matches, PREG_SET_ORDER))
{
for($i=0; $i<count($all_matches); $i++)
{
$reseller_username = $all_matches[$i][1];
$reseller_domain = $all_matches[$i][2];
$reseller_data = $all_matches[$i][3];

// set this intially... although it will likely be set again (but that doesn't matter)
$accountList[$reseller_username][$reseller_username]['domain'] = $reseller_domain;
$accountList[$reseller_username][$reseller_username]['package'] = "undefined";

if (preg_match_all("/<tr class=\"tdshade[12]+\"><td>(.*?)<\/td>.*?<td>(.*?)<\/td>.*?<td>(.*?)<\/td>.*?<\/tr>/is", $reseller_data, $reseller_matches, PREG_SET_ORDER))
{
for($j=0; $j<count($reseller_matches); $j++)
{
$current_user = $reseller_matches[$j][1];
$current_domain = $reseller_matches[$j][2];
$current_package = $reseller_matches[$j][3];

$accountList[$reseller_username][$current_user]['domain'] = $current_domain;
$accountList[$reseller_username][$current_user]['package'] = $current_package;
}
}
}
}
}
}

$this->accountList = $accountList;
}


/**
* Parse fetched account list for domain list, user package list,
* and reseller list.
*/
function parseAccountList()
{
foreach($this->accountList as $reseller => $reseller_data)
{
foreach($reseller_data as $user => $user_data)
{
$this->domainList[$user] = $user_data['domain'];
$this->userPackageList[$user] = $user_data['package'];
$this->resellerList[$reseller][$user] = $user_data['domain'];
}
}
} [/code]
Link to comment
https://forums.phpfreaks.com/topic/14891-confused-on-this/#findComment-59685
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.