screenshot, upload and set as feature for link posts

Hi I have found this code to upload and set as feature the image of the links. This is my modified code:

I have tested with this and not work:

$thumb_url = '';

And test with this and it works:

$thumb_url = '';

1. What can be happening?

Another doubt it that the code not work with the plugin WPUF but works with wordpress backend. I think that the plugin WPUF not uses the action "save_post".

2. Exist a way to add this action to the plugin, to test if works?

Thanks and greetings