Questions tagged [http-api]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
21 views

Remove unwanted fields from WP API response

I am making a mobile app that links to a Wordpress site. There are a lot of unwanted data from the API response and it would be great if I could remove it. How could I do that without touching the ...
1
vote
2answers
59 views

Sending JSON Payload using Request::request_multiple()

I have an external api which takes json body as payload. I am trying to send multiple parallel requests. So I am not using wp_remote_post() The wp_remote_post() version of my code works perfectly. ...
0
votes
1answer
66 views

How to receive JSON payload from a digital device

I have a site with about 100 registered users. Some of the people will be receiving digital scales. The scales send their weight data to a 3rd party server that then sends a JSON Payload as an HTTP ...
0
votes
0answers
61 views

Spektrix API v3 Authentication wp_remote_get()

I have a need to authenticate a GET request to Spektrix. The API requests that require authentication need an API Login Name and a API Secret Key. The API Secret Key needs to be base-64 encoded, and ...
1
vote
1answer
502 views

Return WP_Error as WP_REST_Response

I have a http request to WP REST API that can resolve in a success or a failure status The success gets handled by WP_REST_Response, and if any error occurs this is handled by WP_Error, both returned ...
0
votes
2answers
162 views

WP_Http response throws “Cannot use object of type WP_Error as array”

My plugin is throwing the error "Cannot use object of type WP_Error as array". The line in question is... $http = new WP_Http(); $response = $http->request( $url, array('timeout' => 20)); if( ...
1
vote
0answers
307 views

wp_remote_request header error even though working properly with cURL

I'm trying to make calls to a JSON API inside my wordpress theme. I tried with the cURL option, making a custom function and things works as it should but I wanted to use the built-in wordpress ...
0
votes
1answer
1k views

Send a get request to wordpress

I want to have a url like this: http://example.com?user_id=23&entry_id=34$nonce=4j54hgc465 When a user clicks on this link, I want to do something with this information like update the user or ...
1
vote
1answer
167 views

Allow download_url for lan addresses

I'm hosting a wp site on my own server (at home) and I would like to use wp cli to import media from my own computer. On my computer, I have a web server and I asks to wp-cli to import media from "...
0
votes
2answers
136 views

Why does WP HTTP API switch the method (POST/PURGE) to GET when redirecting (302)?

I discovered after much painful debugging that requests to the the WP HTTP API (in this case, though wp_remote_request()) always ended up as GET method after being redirected, even if the method was ...
3
votes
3answers
3k views

Difference between wp_remote_post and wp_safe_remote_post

The documentation for wp_remote_post says In many cases you may be better served with wp_safe_remote_post Looking at the source code, the only line that's different between the two is that ...
1
vote
1answer
436 views

wp remote post getting a 404 error code

$info = array( 'values' => array( 'email' => 'email@email.com', 'firstname' => "firstname", 'lastname' => "lastname", 'source' => "WEB", ), ); $infoo=json_encode($...
1
vote
0answers
67 views

How to make a implement queue for scheduling tasks in WordPress?

Is it possible to implement some queuing mechanism for task scheduling? In my plugin, I want to run a task triggered by cron for 5 seconds and if not complete, save the state and call another Async ...
2
votes
1answer
2k views

How to run multiple Async HTTP requests in Wordpress?

In my plugin, I want to call 10 or more HTTP requests asynchronously in WordPress so that I need not wait for the response of anyone. Is there any way in Wordpress that supports this and also ...
0
votes
1answer
276 views

Using WP_Http to post data to Webservice without blocking caller script

I've been using WP_Http to post data to a (third-party) webservice. Their webservice is slow like hell so I can't wait for their webservice's answer. I have tried using the parameter blocking = ...
0
votes
1answer
359 views

Save external API calls in WordPress

I coded a WordPress page on which users can submit their name. After pressing submit, it will send an API request to an external API, which returns information about their name. This is a simple ...
1
vote
0answers
683 views

XML-code sent via the POST method to the URL (API) [closed]

I am building a webshop for a client who makes use of drop shipping service. The customer can place the order on the website and the order will be send to the dropshipper automatically. This is done ...
2
votes
1answer
524 views

How to set charset for wp_remote_post request?

I'm using wp_remote_post() on a project and it works great. But seems like the server on which I need to make the POST request is a Windows (ISS) server. So the third-party service that provides this ...
0
votes
1answer
324 views

Creating custom URLs with template to fetch external JSON

Hi guys hope you can help. So I have a WP site and an external JSON enpoint (NOT from another WP) and what I want to achieve is to create dynamic "fake" URLs inside wordpress like: example.com/...
2
votes
1answer
603 views

How do I get URL from WP_HTTP object?

I'm using wp_remote_post: $test = wp_remote_post($environment_url, $args2 ); $test2 = $test['http_response']; So what I want to do is get the value of URL but I believe the object is ...
3
votes
1answer
2k views

How to consume and display external data in WordPress from another website

I am trying to access data from another website to display on a WordPress Website I am developing. So far I have the following: <?php /* Template Name: Testing remote data */ ...
2
votes
2answers
467 views

How to duplicate a curl XML request using HTTP API?

I am working on a plugin that posts an XML request to a vendor's shipping API to get shipping quotes. The XML is stored in a string called $xml. I can post the XML request successfully with curl using ...
15
votes
1answer
20k views

Sending JSON string through wp_remote_post()

I'm building a mailchimp integration and they require a POST call with JSON code. No, I'm using this code that actually works: $data = wp_remote_post($url, array( 'headers' => array('...
0
votes
1answer
795 views

How to set a header in wp_safe_remote_get()?

Previously I am using the below code. Now I need to change this code and replace file_get_contents() with wp_safe_remote_get(). I need to know how to set 'header' => "Accept: application/json" ...
2
votes
1answer
327 views

Extending Wordpress REST API

I'm trying to create an API where external clients can authenticate users and reset their password through a REST API. I've already seen this: External WordPress API. However, it looks like this is ...
8
votes
1answer
6k views

How to remove rest api link: in http headers?

i would like to remove the "link:" line added to the http headers since wordpress 4.4 here is a curl -I killcandida.org here is the output extract of the line that i would like to delete: Link: &...
0
votes
1answer
64 views

Turn twitter-urls into list timelines?

I know there's the oEmbed ability to embed a specific tweet, as described in their documentation... but is there any way to simply get the latest in a particular twitter feed, without setting up an ...
7
votes
1answer
254 views

Mutual Authentiction on HTTPS with Wordpress HTTP API?

I'm currently building a prototype to post data from Wordpress to a Rightmove RESTful JSON API (a rental/property website in the UK - specifically the Real Time Datafeed) Was pretty impressed that ...
1
vote
1answer
2k views

How to make Http Request to a php file present in plugin directory of wordpress

I'am new to wordpress plugin development and I'am developing a plugin (say myplugin) and I'am stuck in following problem. I had kept this plugin in mywebsite/wp-content/plugin/myplugin Inside ...
0
votes
1answer
708 views

cURL vs WP_Http for safety?

when it comes to cross domain request for personal information such as user information it must be done on the back-ed for safety reasons. I'm am new to cURL but it has been pointed out to not use it ...
0
votes
1answer
1k views

Proper context for wp_remote_post()

I would like to use wp_remote_post() within a function to send an HTTP Post Request to a php script inside a plug-in. I'm successfully posting to the plug-in script, but having trouble with the ...
6
votes
2answers
3k views

HTTP digest authentication using wp_remote_get

I am able to implement http basic auth in wp_remote_get using the following code $args = array( 'headers' => array( 'Authorization' => 'Basic ' . base64_encode( $username . ':' . $...
1
vote
1answer
287 views

How do I create an rssfeed from the contents on this page?

So. I created a gmail rss feed with php that I placed in a custom page. I used this snippet: function checkGmail($username, $password) { $url = "https://mail.google.com/mail/feed/atom"; $curl ...
0
votes
1answer
95 views

How to add code to HTTP header

I have a code that I need to insert into the HTTP header of my website to make Google Fonts work again. My Google Fonts aren't rendering on one of my simple websites (http://ceobusinessalliance.com). ...
1
vote
1answer
1k views

WP http XML response HTML encoding and image display problems

This is my very first WP plugin. Theres probably going to be more than one question here and they're all related so I'm going to ask all here. Working test here Tracking number to use: lc0614061377 ...
3
votes
2answers
8k views

Error timed out with succesfull wp_remote_post

What I'm trying to do: Passing POST data by using wp_remote_post. foreach ( $articles as $article_id ) { $postarray = array( 'method' => 'POST', 'timeout' => 5, '...
7
votes
5answers
8k views

How do I mock HTTP requests for PHPUnit?

I'm writing a plugin that makes requests to the Facebook graph API. As I don't want my unit tests to actually make these requests, how would I overcome this? My method calls both wp_remote_get and ...
0
votes
0answers
153 views

Get full page HTML for a non-public Wordpress page

How can I write a function that will return the full rendered HTML of a non-public URL on my Wordpress site—a URL that you must be logged in to see, such as a draft? Not just the post content, but the ...
-1
votes
1answer
6k views

Using the wp_remote_post response body

I don't have great PHP skills, but can usually fumble my way through with a little bit of direction, so I'm hoping someone on here can help me. I am doing a http post submission from a form to a ...
0
votes
1answer
411 views

http_response_timeout filter not working

I am writing a Wordpress plugin that makes calls to external sites. I want to raise the timeout for all wp_remote_* calls, so I added the following to the __construct function of my plugin: ...
1
vote
3answers
11k views

What's the best way to detect referrer?

I've been searching for some WP specific way to detect any referrer. Have an idea? I know how to do that in PHP but I just want to know if there's some WP function to do that? EDIT: here is what I 'm ...
0
votes
1answer
353 views

How to use wp_http with https-pages?

I'm trying to get content from an other site of mine, using iFrame-less Reloaded (http://wordpress.org/plugins/iframe-less-reloaded/) It uses the class WP_http but doesn't work with a page in https. ...
0
votes
1answer
1k views

Add information to HTTP Header in WordPress Plugin

I am working on developing a plugin for a tool called Supportify. It is a REST API that is authenticated through a key and token added to the HTTP header of a HTTP request to their servers. Their API ...
2
votes
1answer
584 views

Connect external web app to wordpress

We have a web app that will allow users to edit their videos; and add intros, outros, and watermarks. Once the user already done on their video. We need to provide an option to post or syndicate ...
2
votes
1answer
274 views

Is it possible to process $_POST / inbound http request in way to automatically create Wordpress post?

I like to learn some of WP automation. The WP get inbound http request to site url and the question is how to create a publication based on post (or get) data structure? How can maintain ...
6
votes
1answer
2k views

Hook into WordPress update?

I'd like to know if there's any way to hook into WordPress update process and send $_POST variable to update server? I'm delivering plugin/theme updates from private server and I hook into this: ...
7
votes
1answer
9k views

How to use the HTTP API with a Proxy?

If I want to route a HTTP request through a local (alias: on the current server) Proxy, how would I go around this? The allowed Proxy settings for the wp-config.php are the following: # HTTP Proxies ...
12
votes
3answers
7k views

Filter any HTTP request URI?

I want to filter any HTTP request URI done through the HTTP API. Use cases: The WordPress update check goes to http://api.wordpress.org/core/version-check/1.6/, but https://api.wordpress.org/core/...
6
votes
3answers
6k views

How to use WordPress HTTP API to download file from remote location

So this PHP code works for me: $ch = curl_init( TCS_CPDF_REMOTE_ZIP ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); $data = curl_exec( $ch ); curl_close( $ch ); ...
2
votes
1answer
4k views

API JSON Data in WordPress

On the Google developer API page, it talks briefly on retrieving a dynamic list of fonts using JSON/JavaScript. I was wondering how would I be able to pull the web fonts API into my Wordpress theme ...