Articles of http api

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 for WP development so instead I am using the inbuilt WP_Http in wordpress. I just want […]

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 reference is here. I know you can add things to the header with wp-config.php but for […]

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: add_filter(“http_response_timeout”, function($timeout) { return 30; }); But the calls still time out after 5 seconds. I also tried using a separate […]

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 context of the request. In functions.php: function post_to_plugin($name, $email) { $plugin_url = plugins_url( ‘/my-plugin/db-insert.php’ ); $form = array( ‘name’ => $name, […]

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 overview: <form action=”” method=”post”> Name: <br><input name=”example” type=”text” /><br> <input name=”submit” type=”submit” /> </form> <?php if (isset($_POST[‘submit’])) { $example = […]

using wp_remote_get to retrieve own url on local host

I have a website in local development at test:8888 and I am trying to get the following to work in my functions.php file. $response = wp_remote_get( ‘test:8888/?p=1’ ); print_r($response); Unfortunately this is printing WP_Error Object ( [errors] => Array ( [http_request_failed] => Array ( [0] => A valid URL was not provided. ) ) [error_data] […]

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 Example XML Response from tracenow.net: <Consignment xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns=”http://tempuri.org/”> <consignmentNumber>lc0614061377</consignmentNumber> <customerRef/> <itemCount>1</itemCount> <name>six red squares</name> <address1>unit 7b victoria business […]

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 = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_USERPWD, $username . “:” . $password); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_ENCODING, “”); […]

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

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 via a POST request by my server, a XML-code containing all the information about the order and is […]

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 myplugin directory i have 2 files as follows myplugin.php registration.php Now i want to make http post request to above registration.php from mobile application. When i sent post […]