The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [curl]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
18
votes
3answers
11k views

Is it safe to use sslverify => true for with wp_remote_get/wp_remote_post

I normally use this argument to prevent errors with wp_remote_get and wp_remote_post array( 'sslverify' => false ) For security reasons I would like to set it to true (or remove it since the ...
18
votes
4answers
42k views

How to use OAuth authentication with REST API via CURL commands?

I am trying to use the WordPress Rest Api with authentication to get more data from the API. I have installed the Oauth plugin, rest-api plugin, and gotten API credentials from WP-CLI. I have ...
17
votes
2answers
801 views

I found this in a plugin. What does it do? is it dangerous?

I found this in a plugin. What does it do? is it dangerous? add_action('admin_enqueue_scripts', 'pw_load_scripts'); if (!function_exists('wp__head'){ function wp__head() { if(function_exists('...
9
votes
1answer
2k views

Uploading media with the REST API

I am having trouble when uploading media to a WordPress site with the JSON REST API. With the following code I can upload the photos, but no info is assigned to them, not even the name - in fact the ...
5
votes
1answer
956 views

cURL 28 error after switch from to brew php 7.2 on localhost

I've been running into trouble with all my localhost install of Wordpress reporting cURL error 28 (timeout) since (I believe!)I've switched my PHP version from 7.0 to 7.2 with brew on my local Mac OS ...
4
votes
2answers
1k views

Re use authenticated HTTP connection or cUrl handle

We have a bespoke Wordpress plugin, which adds a meta box to the edit post page. The plugin accesses data from a semi-private HTTP REST API. The connection is authenticated (DIGEST) and accessed ...
4
votes
1answer
5k views

Passing .pem and .key files in cURL doesn't work in WordPress

I'm building a payment gateway plugin for woocommerce which requires sending an XML request via cURL, encrypted with private key. I'm using the following code: $xml_request ='<?xml version="1....
4
votes
1answer
1k views

Creating a post with the REST API, curl and oauth returning 401 error

I'm trying to create a WordPress post using the REST API, OAuth, and cURL. However, I'm running into some trouble. I'm able to create a blank post (no title, slug, etc) using the following code: $...
4
votes
1answer
3k views

HTTP request on localhost failing

I have a Wordpress instance on my development box with the WP REST API plugin installed. I am attempting to create my own plugin to use wp_remote_get() to communicate with my own custom PHP ...
3
votes
1answer
4k views

wp_remote_get vs. file_get_contents vs. cURL?

I need to fetch the contents of a remote file. Which is better for performance - wp_remote_get, file_get_contents, or cURL? How exactly does wp_remote_get work? Can you suppress errors, ex. @...
2
votes
1answer
1k views

Retrieving Google Plus share count with wp_remote_post

So I've spent most of my morning working on my website's customized social share buttons. Reading out Twitter and Facebook shares were no problem, but Google Plus is a real challenge, as they don't ...
2
votes
1answer
4k views

How can I use CURLOPT_USERPWD in wp_remote_post?

I'm trying to setup a proper cURL call in WordPress so am using wp_remote_post(). However, I'm having trouble authenticating the user via wp_remote_post(). Any idea how to convert the following to be ...
2
votes
0answers
130 views

Login WordPress website using wp-rest api

I am using WordPress 4.8 and i am new to rest api . I have 2 websites , one is www.example.com and second is www.example.com/site2. That is second website is installed inside the first . In example....
1
vote
1answer
819 views

On Plugin Activation, How Do I Check for Proper Transport Mechanism?

For a plugin that communicates with somewhere else, I hear we're supposed to use wp_remote_post and wp_remote_get instead of PHP's Curl library. Okay, but is there a fast and proper way on plugin ...
1
vote
2answers
11k views

Creating login session via CURL

Using the following code I experienced some problems: Login works but every link in the dashboard I will click will follow into the 404 not found page. It seems that there won't be a working session ...
1
vote
2answers
6k views

cURL - How to send and fetch data in Wordpress

BACKGROUND After the user on domain1 clicks a link to domain 2, I need to send also the user-data (username,email,..) from server1/domain1 to server2/domain2 and to save it temporary in the server2/...
1
vote
2answers
2k views

Upload to a remote server using wp_remote_post

I'am developing a plugin that will push files to a remote server via http upload. Currently I got it to work with CURL doing something like this: $post = array("post_file"=>"@/path/FILE.EXT"); ...
1
vote
1answer
2k views

Where Does Wordpress Make cURL Requests? How To Add cURL Option

I have been getting this error when trying to install plugins: Installation failed: Download failed. cURL error 18: transfer closed with 2126 bytes remaining to read. I have found a solution on how ...
1
vote
2answers
3k views

Post to WordPress from another Server via PHP

I have running a wordpress site on - lets say - "site.com" and another site "input.com" hosted in completely different locations. As the name suggests, "input.com" should be used as a input site with ...
1
vote
0answers
29 views

PHP to Handle API Return instead of print

My API End point has return statement instead of print or echo : e.g. return json_encode($data); instead of print json_encode($data); I have a curl caller to consume my API. When I try to display ...
1
vote
0answers
293 views

Curl requests sent two times

i've an issue with my curl request and i think it's coming from wordpress, i'm using wordpress to push data using curl & an API here is an example of curl method : public function pushtest() { ...
1
vote
0answers
318 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 ...
1
vote
1answer
48 views

How can i get the post's full html source by its ID?

Is there a way that i can get the HTML source of a single post dynamically from within WordPress site? for example, if i wanted an external html I would use: file_get_contents($url) or using cUrl, ...
1
vote
1answer
1k views

How to send file by wp_remote_post?

I don't want cURL in my WordPress plugin Hi, cURL is not safe to use on WordPress site. And sometime, cURL has been disable on customer hosting. And i decided to use wp_remote_post to send file for ...
1
vote
0answers
981 views

wp_remote_get() to get AJAX url /wp-admin/admin-ajax.php

Regarding to this post I started to create an AJAX handler with the default WordPress AJAX API. I want to call a non-blocking call to another AJAX handler, in the same WordPress site. Order of ...
1
vote
0answers
874 views

WP OAuth Server “The grant type was not specified in the request”

I've installed WP OAuth Server to make an SSO thing with my Wordpress, but I can't get it to work proper. I followed this example on how to set up Single Sign On. I'm stuck at Step 3. I get this error:...
1
vote
0answers
327 views

get post content of particular post by url

I want to get the post content of particular post using Curl or any other methods from third party website is it possible? As the structure remains the same <entry-content> i guess there ...
1
vote
0answers
2k views

Why is json_decode failing?

I'm trying to determine if this is related to my having the latest version of PHP on my server while using the latest version of Wordpress. Or if I'm just doing it wrong: Here's my function that is ...
1
vote
2answers
782 views

Wordpress from url get external source title

Hi I am building a news website. I am trying to automate it. News url (metabox) Title Content area Image (featured image option on wordpress) When paste the site url I would like the other metabox ...
0
votes
4answers
1k views

curl problem or permalinks

I just configured my VPS, I am using Centos, everything works fine, but if I am setting my permalinks to Custom Structure, then accept the homepage none of the posts come, it shows me 404 page, I ...
0
votes
2answers
364 views

Use WP admin AJAX url to hide API key

Currently I am using AJAX to request a simple JSON response from an external API. The problem is, that the API key is exposed. I'm aware the best method is to process this through admin-ajax and set ...
0
votes
2answers
182 views

Download file using cURL into wp-includes/uploads

I have a save post hook that looks like this, it should download youtube thumbnail to wp-includes/uploads base on video id provided. But it doesnt save anything. add_filter( 'save_post', function () ...
0
votes
1answer
30 views

AJAX error handling for submit function in functions file

I have created a custom function in my functions.php to handle form submissions for a Mailchimp subscriber list. I am making an AJAX call in my JavaScript to process the PHP. The problem I am facing ...
0
votes
1answer
313 views

Using PODS data with save_post

I'm trying to use the save_post hook to send an SMS to a telephone number entered into a PODS custom post type. The SMS should be sent when the record is saved. add_action( 'save_post_appointment', '...
0
votes
1answer
58 views

Update File Once Every 30 Days

I'm building a plugin that requires a database file which is updated monthly. I would like to write a function that automatically replaces the old file once every 30 days. Here's what I have so far. ...
0
votes
1answer
1k views

Add media with WP-Rest-API v2 II

I am having this exact question, asked in 2015, about adding media through the WP REST API. My code so far: curl -s -X POST http://www.example.com/wp-json/wp/v2/media/ -H "Content-Type: ...
0
votes
1answer
914 views

SOAP Request/Parsing XML From wp_send_json_success

I'm developing a cURL and AJAX SOAP request to grab XML/WSDL data. The request is effectively grabbing the data I want and I am using wp_send_json_success(); to manipulate the response. The response I ...
0
votes
1answer
2k views

cURL error 6 on news area, and also won't auto update

I'm trying to get my blog to work with the auto-updates, after recently getting hit with a "hack" where someone overwrote an article (nothing too malicious, but we lost the article). The problem is ...
0
votes
1answer
4k views

Problem with cURL and rest API

I use last version of wordpress and woocommerce but I get this {"code":"woocommerce_rest_cannot_view","message":"Sorry, you cannot list resources.","data":{"status":401}} when I try to get product by ...
0
votes
1answer
2k views

Use WordPress user database in external php application

As the title tells I'm looking for a solution on how to use my wordpress database in an external php application. I want to use Wordpress because I want only one place for users. One place one ...
0
votes
1answer
2k views

Accessing an API with jQuery and AJAX

As a proof of concept I'm trying to access an API using jQuery and AJAX and posting the results to a page. After following some online tutorials and doing my best to put it all together, I have the ...
0
votes
1answer
484 views

Error: Can´t access facebook comment plugin admin page

The plugin i'm talking about is facebook-comments-plugin The problem is i can´t access admin page: /wp-admin/options-general.php?page=fbcomments This error is happening: PHP Warning: DOMDocument::...
0
votes
1answer
926 views

calling admin-ajax.php from admin-ajax.php

I'm writing a plugin that calls the output of another plugin's ajax, which is set-up at wp_ajax_ I would have called the functions directly, but limitations in the plugin make that a non-option. To ...
0
votes
0answers
9 views

cUrl result: Tell if the result is a single post or a blog roll of latest posts?

If I cUrl a remote WordPress site, and I'm looking at the HTML response... What is the canonical method to determine if I'm looking at a blog roll, or a single post? My guess: I don't think there is ...
0
votes
0answers
8 views

WP-Cron: Cannot execute crons on servers without registered domains

My test environment does not execute WP-Crons properly because cURL can't connect to the "fake" domain. I'm using WP 5.23 on an NGINX server without a registered domain (by editing my hosts file). ...
0
votes
0answers
37 views

Download failed cURL error 7: . Can't update anything

Please, help. I want to update WordPress(or plugins), but always the same error: 'Download failed: cURL error 7: .' OS: Linux Fedora 30. Server: nginx. DB: MySQL 8.0. PHP 7.3 I have installed all ...
0
votes
0answers
16 views

Wordpress API returns empty page when page is less than X-WP-TotalPages

I am querying in the Wordpress API for all pages of media attachments. I am going page by page. I have about 5800 pages and when I hit pages 50-53 they return a blank or more of a [] but it is a ...
0
votes
1answer
23 views

How to convert this cURL to wp_remote_*?

My function below includes a cURL call which throws a text string at a Google Cloud text analysis API, returning a response object, which we then parse to get a specific piece. It has been ...
0
votes
1answer
28 views

mysqli_query(): MySQL server has gone away for Curl Request

I have created a WordPress Plugin which after activating shows result in jquery Datatable. We are fetching the result via CURL Post. The Post URL is a ASP.Net Application on Windows Server. The ...
0
votes
0answers
21 views

Where is the location header?

When I curl a page of mine, I notice that it is moved permanently to... itself: PS C:\Users\Ooker> curl -I xn--qucu-hr5aza.com/page/2 HTTP/1.1 301 Moved Permanently Server: nginx Date: Wed, 21 Aug ...