Im working on small website scrapper with cURL.
I decided to use preg_match to find header and article content.
This is my code:
preg_match('@<h2 class="title">(.*?)</h2>@s', $this->website, $this->title); if(sizeof($this->title) > 1) $this->title = trim($this->title); // rewrite first element of array to regular variable
I was experimenting with it and I found, that if there is one match - it returns it in array at index 1, not 0.
Edited question: Why is this 1, not 0? Im doing something wrong?
My server: Apache/2.4.3 (Win32) PHP/5.4.7