curl и wp_remote_request

При написании плагинов к WordPress приходится править curl на wp_remote_request() ибо иначе ругается поддержка WP plugin directory:

You will not be able to submit another plugin while this one is being reviewed, so please read the email carefully. We know it can be long, but you must follow the directions at the end as not doing so will result in your review being delayed. It is required for you to read and reply to these emails, and failure to do so will result in significant delays with your plugin being accepted.

## Including your own CURL code

WordPress comes with an extensive HTTP API that should be used instead of creating your own curl calls. It’s both faster and more extensive. It’ll fall back to curl if it has to, but it’ll use a lot of WordPress’ native functionality first.

Простейший пример с базовой авторизацией.

Простая замена но с подвохом, который чреват ошибками.  CURLOPT_USERPWD эта опция у curl без base64. Потому что само расширение формирует заголовок для базовой авторизации.

You may also like...