I get an error on this line:
$name = $html->find('a.ProfileHeaderCard-nameLink')[0]->plaintext;
The error is:
Parse error: syntax error, unexpected '['
How can I make this work? It works perfectly on localhost for some reason.
I get an error on this line:
$name = $html->find('a.ProfileHeaderCard-nameLink')[0]->plaintext;
The error is:
Parse error: syntax error, unexpected '['
How can I make this work? It works perfectly on localhost for some reason.
Try this ,
$name = $html->find('a.ProfileHeaderCard-nameLink');
$name = $name[0]->plaintext;
Are you sure you are running the same PHP versions locally and on your server? Accessing an array directly after returning it from a functin is a feature added in PHP 5.4, see http://php.net/manual/en/migration54.new-features.php