preg_match_all regex

Having issues using regex to grab HTML contained in a certain span.
Trying to get it to get safeytrfyh is available! on to make a fast checker that will check a pre-specified list if usernames are available instead of constantly typing in the username and clicking check.

An example page you guys can use is
Im using cURL for this:

//Urls to scrape from.
$URLs = array();
$URLs[] = '';
$working = '';

//Curl scraper.
foreach($URLs as $URL){
$ch     = curl_init();
curl_setopt($ch, CURLOPT_URL, $URL);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);        
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$page = curl_exec($ch);
$accounts = array();
foreach($accounts[0] as $account){
    $working .= ''.$account.''. PHP_EOL . '';

//Put the scraped check into the new .txt file.
file_put_contents('accounts.txt', $working, FILE_APPEND);

Source: regex

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.