1

I have a php script that uses curl_multi to make multiple requests at the same time.

It accesses several of my sites in search for a defined value.

Now the problem that I have is that the curl requests should stop if it found the value I'm searching for on one of the sites.

Let's say I parse 1000 pages for the word stackoverflow. The script accesses those pages with curl_multi and 10 requests at a time. Let's say the script found the word stackoverflow on the 589th page, it should stop all further requests now.

Is that somehow possible?

Jeremy
  • 1
  • 85
  • 340
  • 366
Matthias Dunnowa
  • 119
  • 1
  • 1
  • 12

1 Answers1

1

somewhere in your code, your have a loop that processes the individual curl handles. In that loop, you insert the following logic.

if(shouldStop()) {
    break;
}
goat
  • 31,486
  • 7
  • 73
  • 96