Пример #1
0
 /**
  * @param string $url
  * @param string $clientId
  * @param string $scope
  * @return $this
  * @throws NoFormException
  */
 public function open($url, $clientId, $scope = '')
 {
     $this->_source = new \SimpleXMLElement(self::ELEMENT_VOID);
     $this->crawler->setUrl($url)->setClientId($clientId)->setScope($scope)->setRedirectUri('http://localhost');
     $this->_source = $this->crawler->load()->extractSimpleXmlForm($this->xpath);
     return $this;
 }
Пример #2
0
    $url = "http://uae.souq.com/ae-en/" . $search_text . "/s/";
    $crawler = new Crawler();
    switch ($search_type) {
        case '0':
            $crawler->setSearchTypeQuery('');
            //Best Match
            break;
        case '1':
            $crawler->setSearchTypeQuery('sortby=ir_desc');
            //Top Rated
            break;
        case '2':
            $crawler->setSearchTypeQuery('sortby=sr');
            //Popularity
            break;
        case '3':
            $crawler->setSearchTypeQuery('sortby=cp_asc');
            //Price From Low To High
            break;
        case '4':
            $crawler->setSearchTypeQuery('sortby=cp_desc');
            //Price From High To Low
            break;
    }
    $crawler->setUrl($url);
    if (!empty($_POST['page_limit'])) {
        $page_limit = $_POST['page_limit'];
        $crawler->setPageLimit($page_limit);
    }
    echo @$crawler->crawlSouq(true);
}