How to run a function on plugin’s options page?

Simply register an additional sub-admin page for your plugin More info here. Then perform a wp_remote_request() to fetch the data. Loop through the results, display it in some sort of view for the end user – for e.g. a WP_List_Table and save your post types. Name the admin sub menu entry “Updates” and you’re done.

If you really need to implement another update button, use the same styles as get_submit_button() – the native WP admin button – uses and add them to an anchor/link that links to your sub-admin page. This as well separates the user feedback (the view) from the rest of the page, let’s your plugin shine more, goes inline with WP core admin styles and overall let’s your plugin look bigger with a better separation of concerns.

Hint: Click through all the links in this answer, as I linked to previous answers that explain the details.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)