-3

I am using webscraping to get data from a certain website using SIMPLE PHP DOM PARSER CLASS There are few problems i am facing.

  1. There are two websites which are returning an error HTTP 403 forbidden
  2. Secondly As per the below code i am scraping 9 products from 9 URLS after 8 URL's i get error i shuffle the urls and checked single one but its not the url its the execution time or web requests may be allowed as i get Appache windows error .I tried to delay it using sleep(10); it didnt worked any help would be highly appreciated

          $url = $this->urls['abc'].'Product/1/1_oz_Gold_American_Eagle___Random_Year.aspx';
            $regex = 'span[id=ctl10_ctl00_tc1_TabPnlProdDesc_lblbuyprice]';
              $data=$this->getCoinVal($url,$regex);     
    
                       $this->update_scrap(GAE_1,APMEX,strip_tags($this->r_dollar($data)),$url);
    
4

2 に答える 2

2

Use this for time delay in bracket ()

  import time

  time.sleep(sec)
于 2016-11-02T06:02:37.167 に答える
0

エラーは、Apacheサーバーのメモリリークが原因でした。

したがって、これらの2行を使用すると、機能します。

              $dom->clear();  
              unset($dom);

ここで、$domはパーサークラスのオブジェクトです

于 2013-02-02T07:15:29.700 に答える