Instead of custom curl HTTP request I’ll recommend you to use the wp_remote_post() or
wp_remote_get() which internally call the HTTP request and handle all possible errors.
Also use download_url() to download the file and media_handle_sideload() to upload the downloaded file into uploads directory.
Related Posts:
- Redirect to another page using contact form 7? [closed]
- I want to allow certain file types on dokan upload files
- Remote upload file to server B
- Plugin update error message
- Keep one user logged for a year?
- Customizing subject in comment notification e-mails
- if plugin is active? check if plugin is enabled or not?
- WP showing “warning: call_user_func_array()”, What to do?
- Adding a text domain to every __(), _e() and __n() gettext call without a plan to create own translations
- Saving Plugin settings to the database
- Set a User as Author of all ‘New Posts’ posted
- Post source link plugin – small modification
- How to turn off email you receive when registered?
- Custom Widget outputs the input but doesn’t save anything inside the textarea
- Deleting images through upload folder, but not deleting from media library
- How can i change an image’s author?
- How to Replace Words with Hypertext Link But Ignore Previously Existed Links?
- How to get post URL in the_content filter?
- How to get subscription key or id using Woocommerce Subscriptions [closed]
- Missing argument 3 for wp_register_sidebar_widget()
- WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page
- add_query_arg not working
- Shortcode button dosent work for all posts. Work for first post only
- Theme my Login plugin, how to update fields
- Edit Yoast SEO breadcrumbs output [closed]
- Restrict media upload size by format
- Override Plugin Script Fucnction in WordPress
- Replacing a plugin function with a custom renamed function doesn’t work
- How to call WordPress function other files
- All sites themes functions.php have been changed
- Conditional attributes and logic per product category
- Media Upload Tab reload and change $_GET
- WordPress get_avatar function not correct working
- What is @Action in WordPress?
- Check if variable is set in filter
- JQuery prepend a function
- Why can’t I call a (member) function from within a foreach?
- Are there action hooks for comments?
- Help with WP Business Directory Manager Plugin?
- wp_dequeue_script for a Plugin
- wp_enqueue_scripts
- Return multiple values in a shortcode attribute
- get specific value of a array | PHP
- How to make a dynamic css class whose name changes every visit to confuse scraper
- Plugin onclick button activate other plugin
- How can I fetch data from another website to my wordpress website with mysql database
- Send email with list of active plugins upon activation/deactivation
- Programatically upload a file to be stored inside blob field in database, NOT on filesystem
- Using custom fields for image alt and title
- Add the_post_thumbnail_url to a shortcode in function.php
- Different registration form for different roles
- Adding a Tag Parameter / Filter to My Shortcode
- How to upload large media file in chunks, without any plugin?
- add_rewrite_rule to load different page, without changing URL in browser
- WordPress Custom Hook with Class method
- Allow a particular user to access a particular plugin?
- WP Function does not trigger on Webhook API Call
- Cookie value changes back to previous value after changing
- Post source link plugin – small modification
- Is there any way to sync Facebook Comments and with comments on WordPress website?
- Share my WordPress plugin for updating how?
- How to create algorithm for ordering posts in WordPress?
- Adding discount functionality to the cart
- Precheck fields when I add a new post
- Get Shortcode output to database for static post_content
- working code, not working – Plugin Dev
- Easiest way to load/fire a handful of functions, IF checkbox is checked?
- Block plugin update possibilities (but not by hiding notifications)
- post id or permalink auto-incrementing number and reset everyday
- Change custom rewrite rule when permalink is updated/changed
- Move plugin upload folder from mywebsite.com/wp-content/uploads/pdfuploads to mywebsite.com/pdfs?
- Return function results within shortcode
- Configuring default woo commerce login with modal popup
- register_activation_hook doesn’t fire at all
- Update (a function) post’s featured image as soon as $image_url changes
- My ajax request don´t work and return 0
- Populate select option with JSON file
- How to echo a plugin’s function into a template?
- Find all strings between an enclosing shortcode
- It possible to implement an adhoc php web application with wordpress?
- Create csv file in plugin
- Posting code inside the post instead of in the template file using shortcode
- Metabox Data not saving
- Contact Form 7: custom validation [closed]
- Can anyone tell me why I can’t edit a plugin when it is installed without having to re-install?
- date function not correctly returning date
- How to disable register and reset the password from WordPress admin panel?
- How use Dynamic hyperlink on each wordpress post?
- How to prevent page load on form submission
- How to tweak a plugin without preventing it from updating
- WordPress: code structure
- PHP if url extension action=discussion condition use [closed]
- Adding a script & php to functions.php
- PHP Creating a formula from mysql db values and db stored math operator
- wp_handle_upload – specified file failed upload test
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- Make plugin admin page visible to other roles
- WordPress Convert queries to slashes using function.php
- How to change all the urls of the WordPress site?