You have a PHP Syntax error in this line:
$_product->setreference($product_data->_source>reference);
You have a de-reference but are missing a hyphen. You wil also want to use a capital for setReference. It should instead be:
$_product->setReference($product_data->_source->reference);
I haven't looked into if this is actually the code you want to run but it clears up the syntax error.
----
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution" as appropriate. Thanks!