The curl_init
function accepts an url and what you are passing there looks like a command line call.
Please check this link for an example of passing username and password through php curl
functionality.
Basically you have to use just http://localhost/wp-json/wc/v1/products in curl_init and set username using curl_setopt
function with CURLOPT_USERPWD
parameter.
Example:
$ch = curl_init('http://localhost/wp-json/wc/v1/products');
curl_setopt($ch, CURLOPT_USERPWD,'your credentials');
//other options here
$res = curl_exec($ch);
curl_close($ch);
Related Posts:
- WooCommerce: Can’t use wc_get_products for custom REST API endpoints
- Process checkout using WC REST API
- How to build a plugin that supports authenticated POST requests to the REST API from external servers?
- Extend Woocommerce rest api routes fails
- How to filter Post using Meta Data REST API
- How to stop a Gutenberg Block from firing multiple GET Requests?
- Output JSON object with woocommerce products
- Woo API REST : product variation price is read-only?
- Category Tree In WooCommerce Product API
- How to upload Woocommerce product images via API? [closed]
- How to handle Woocommerce API credentials
- What will make Woocommerce REST API to issue 401 [closed]
- Woocommerce custom endpoints
- Woocommerce REST API – updating an order changes custom tax calculations
- Woocommerce Rest Api Categories problem [closed]
- API returns blank response after installing & uninstalling WP-rest-api plugin
- woocommerce axios react
- Get specific values in Woocommerce Rest API
- wc_get_products() not return the images details
- WooCommerce – Add product with image via REST API
- Tax are not showing on order while placing order with REST API
- JWT on Woocommerce cannot work with “Customer” role user
- Woocommerce REST API – add filter to set maximum query per page for product brands [closed]
- WooCommerce – Create multiple product tags via rest api endpoint
- Using the WordPress and WooCommerce REST APIs in the same Node app
- Retrieve Data from Custom Endpoint
- How to solve `Error getting remote image` in woocommerce rest api script?
- Getting in an exception for get product detail by id in woocommerce REST api
- Impossible to create a new WooCommerce customer using Rest API
- Woocommerce API security concerns
- How can I send information when a order is completed to my own POS?
- Woocommerce Rest API: woocommerce_product_invalid_image_id
- WC Booking query bookings with date ranges
- “error_message”: “Sorry, you cannot list resources.” using WooCommerce API
- Woocommerce REST API: creating variations
- Woocommerce REST API not considering discounts and coupons
- Update products with curl (bash)
- WooCommerce REST API endpoints don’t exist
- Fetch products with filter by similar categories at same time
- Send data to external websites when there is an update or create a post
- Auto generating API keys using the Application Authentication Endpoint [closed]
- GET woocommerce order request is not showing meta data [closed]
- Hidden woocommerce products still showing up in search results [closed]
- WooCommerce Shop Page Not Found 404
- How can I show an empty WooCommerce cart? [closed]
- Filter on a custom product attribute in WooCommerce using meta_query or tax_query [closed]
- Woocommerce : How to attach an custom attachment with customer-processing-order.php email template [closed]
- Woocommerce Pre Orders – Can i override templates?
- Does the woocommerce_order_status_changed hook fire when WooCommerce updates an order status automatically? [closed]
- WooCommerce Display Digital Download Files Type and Size
- woo commerce get all orders item given category
- Woo commerce+ Stripe – How to associate one account per currency [closed]
- WooCommerce – Stock in Decimals, Using Quantity Intervals with Unique Prices [closed]
- Adding product info for printing to custom Woocommerce Product Display tab [closed]
- WooCommerce – Trigger Checkout Form Validation
- Add shipping address to Woocommerce order emails [closed]
- add sub subpage endpoint to woocommerce plugin my-account section
- Show Content On below single product with specific category
- How to change a WooCommerce Subscription Deposit and Monthly Payment? [closed]
- how to change the “return to shop” button text? [closed]
- REST API works in browser and via AJAX but fails via cURL
- how to scrolling image on single product page
- How to display WooCommerce product tag names on home and category pages
- Problem while adding the variable product woocommerce
- How do I create a filter to hide the One Click Accessibility plugin button in WordPress?
- customers are not showing up in woocommerce
- Woocommerce pre_get_posts query variation meta data not working
- Can’t hide product attributes with css on WooCommerce Product Page
- Woocomerce Edit source code of form in wordpress
- Single Product Page as a Popup
- Woocommerce to get restaurant table numbers in the checkout fields from the url
- Jump to Footer On Scroll – Woocommerce Pages Phones Only
- WordPress Development Workflow
- Woocommerce redirection product_name -> product_cat/product_name
- Loop Through Current Woocommerce Product Categories Sub Categories
- why my price is not showing while adding new product?
- How to send Woocommerce Customer Details (Name, Email and Phone Number) to Admin upon signup
- Sending billing details via POST request to an API
- Remove username and account password field from checkout page
- How to send an invoice with details to the customers
- Need to forward Data from WooCommerce Webhook sent to same site WordPress REST API custom endpoint
- Tax exclusive if coupon applied else tax inclusive in items
- How to change “add to basket” button text in WooCommerce based on product category?
- Select all product woocommerce
- Woocommerce Setup not completing
- woocommerce: when adding or removing items to cart , it takes cart a few seconds to read changes?
- When to use a child theme for WooCommerce Storefront?
- WooCommerce: Bulk Quantity in Cart
- Remove Span Class From Woocommerce Price
- Woocommerce shows empty columns [closed]
- Product atributes in title of order (not in description)
- How to create custome pdf file of my invioice in wordpress
- How to get sub items of parent menu item?
- Notice: Trying to get property of non-object in bodycenter [closed]
- WooCommerce remove billing detail completly
- unable to get product by category only getting product added lastly
- Add second price option based on payment method at cart item price
- Create WordPress account on different domain when WooCommerce order completed
- Creating a woocommerce order when a user creates an account
- I want to update shipping charge $0 for all Woocommeerce Subscription auto-renewal orders