Oara\Network\Publisher\Afiliant::getMerchantList PHP Method

getMerchantList() public method

public getMerchantList ( ) : array
return array
    public function getMerchantList()
    {
        $merchants = array();
        $valuesFromExport = array(new \Oara\Curl\Parameter('c', 'stats'), new \Oara\Curl\Parameter('a', 'listMonth'));
        $urls = array();
        $urls[] = new \Oara\Curl\Request('http://www.afiliant.com/publisher/index.php?', $valuesFromExport);
        $exportReport = $this->_client->get($urls);
        $doc = new \DOMDocument();
        @$doc->loadHTML($exportReport[0]);
        $xpath = new \DOMXPath($doc);
        $results = $xpath->query('//*[contains(concat(" ", normalize-space(@id), " "), " id_shop ")]');
        $merchantLines = $results->item(0)->childNodes;
        for ($i = 0; $i < $merchantLines->length; $i++) {
            $cid = $merchantLines->item($i)->attributes->getNamedItem("value")->nodeValue;
            if (\is_numeric($cid)) {
                $name = $merchantLines->item($i)->nodeValue;
                $obj = array();
                $obj['cid'] = $cid;
                $obj['name'] = $name;
                $merchants[] = $obj;
            }
        }
        return $merchants;
    }