Search code examples
phpphpcrawl

How do I use setTmpFile() method of phpcrawl class?


I am using this WebCrawler class http://phpcrawl.cuab.de. There is a method named "setTmpFile()" http://phpcrawl.cuab.de/classreference.html#settmpfile. I want to know that how can I use this method? Please suggest me some Good example.


Solution

  • The method streams downloaded content to the specified file. I don't know why you'll need to change this file (PHPCrawl will create one automatically), but here is an example:

    $crawler = new MyCrawler();
    $tmpFilename = tempnam('/tmp', 'crawler_');
    $crawler->setTmpFile($tmpFilename);