Download file using cURL into wp-includes/uploads

There is special wp_upload_bits() function to upload the content to the ‘uploads’ directory. Also, there is no such directory as /wp-includes/upload/. The code was not tested! <?php $video_id = ‘xxxxxxxxxxxxx’; $thumbnail_types = array( ‘0’, ‘1’, ‘2’, ‘3’, ‘default’, ‘sddefault’, ‘mqdefault’, ‘hqdefault’, ‘maxresdefault’, ); foreach( $thumbnail_types as $type ) { $file_name = $type . ‘.jpg’; $youtube_thumb_url=”http://img.youtube.com/vi/” … Read more

How to send file by wp_remote_post?

I found an solution for this issue, i using wp_remote_post to send binary of file to server. When processing data received on server, i use this code to get data of file $file = file_get_contents(‘php://input’); And i write it to temp file $temp = tmpfile(); fwrite($temp, $file); $metadata = stream_get_meta_data($temp); Do you have any other … Read more

How to convert this cURL to wp_remote_*?

/* ########################################################################## * * * DETERMINE ENTITY, via native wp_remote_post() call * /* ########################################################################## */ function get_entity_type_via_wp( $text_to_analyse, // passed string to be handed to GClouD NLP $entity = ‘type’ // part of each “entities” result to return ) { // Google Cloud API key $options = get_option( ‘cxt_settings’ ); $google_nlp_api = $options[‘cxt_gcloud’]; // Call … Read more

wp_remote_get – cURL error 28 – only on same domain

By default, WordPress set the timeout value for cURL in wp-includes/class-wp-http-curl.php to 5 seconds and the same value is also set to HTTP requests in wp-includes/class-http.php that is a newer class for making HTTP requests that can use also cURL if it’s present in the server. In your case, 5 seconds was not enough to … Read more

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