Questions tagged [curl]

Specify questions about cURL which provide library and command-line tool for transferring data using various protocols.

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

Update attribute value by Magento curl in observer

Hii. I want to update attribute value by magento curl in observer of product save after event in Magento 2.3 But now with my code, i am getting an decoding error message, while print the response in ...
user avatar
0 votes
1 answer
51 views

Convert Php Curl to MAgento2 Curl

I have created this code but now I want to convert this code to magento2 curl library $ch = curl_init(); //curl_setopt($ch,CURLOPT_USERAGENT, $user_agent); ...
user avatar
  • 3
0 votes
1 answer
49 views

Magento how to download plugin directly by link via curl or wget

I would like to download single plugin zip file with curl or wget and I always get FORBIDDEN response. As an example let use this magento-language-es_es-100.4.0.0.zip it's available under https://repo....
user avatar
1 vote
1 answer
92 views

How to use curl in magento 2 cron?

I have cron set up which will run to import the data using the curl. I want to use curl using magento's way
user avatar
  • 183
0 votes
0 answers
75 views

Magento2 : How to send a request for a page and get the page status?

I want to check if the status of the page is not 200, then add it to the array along with the status and send it to the mail at the end of the script I can't finish the code, tell me how to implement ...
user avatar
  • 1
0 votes
0 answers
195 views

Cant get Admin Token using cUrl 403 error

I've managed to get the API Token using Postman however, when I try to get the admin token through a cUrl request it returns a 403 error. Postman Post Request: https://localhost/index.php/rest/V1/...
user avatar
0 votes
1 answer
137 views

curl_exec issue in Magento 2.4.1 and PHP 7.4.x

I have following code in the Magento site for getting external site data in PHP file, this worked fine in Magento CE 2.3.6 site but getting HTTP error code 400(Bad Request) after upgrading Magento to ...
user avatar
  • 335
0 votes
0 answers
39 views

How to add a script in a phtml file

I currently have a email pop up modal in my magento CMS but I need to hide the api so my script I will keep server side in PHP. My question is how can I have a phtml that is just a script be imported ...
user avatar
  • 47
0 votes
1 answer
624 views

Using REST API with admin username and password is good or safe in Magento 2

I am using REST API in Magento 2. For using in Guest user i want to create admin token so i have used CURL Request like this. $ch = curl_init(); $userData = array("username" => "...
user avatar
  • 526
0 votes
0 answers
212 views

Curl request doesn't login to my API, why?

I've been working on this code to log in to my API. But every time I try to login using CURL I get the following error {"message":"The request entity's media type 'multipart/form-data' ...
user avatar
  • 71
0 votes
1 answer
17 views

I added a Curl.php file in another location. Now I have a Fatal Error when accessing the backend of my store

I added a Curl.php file in another location. Now I have a Fatal Error when accessing the backend of my store. (Yes, I deleted the other location already, but I still receive the error) Does anyone ...
user avatar
0 votes
1 answer
55 views

Magento2 : Add simple product with custom options To cart Rest API

hello I need to Add simple product with custom options To cart throw Rest API I succeeded t add the simple product , price is correct and every thing is ok but unfortunately I didn't succeed to add ...
user avatar
0 votes
1 answer
358 views

Using curl with graphql issue

I made the schema.grapqhs with this content: type Query { quoteData ( id: Int @doc(description: "Id of the Quote Data") ): QuoteData @resolver(class: "Vendor\\Module\\...
user avatar
  • 3,535
2 votes
1 answer
421 views

Change Magento 2 website based on IP

I have 3 websites in my current Magento installation and are as follows website1 Code: base, website2 Code: au, website3 Code: ca. Each website has one store and one store_view except for website3 ...
user avatar
1 vote
1 answer
298 views

Magento 2: file_get_contents and curl not working on server

file_get_contents and curl not working on server but working well in local. And also allow_url_fopen = On. $b1 = "https://www.demo.com/"; $response = file_get_contents($b1); print_r(...
user avatar
0 votes
1 answer
188 views

Curl magento 2 store on docker

I'm trying to curl a docker dev install from itself using Magento\Framework\HTTP\Client\Curl I get a failure and the result SSL certificate problem: self signed certificate Got the options set $this-&...
user avatar
0 votes
1 answer
360 views

Magento 2.3.5 Checkout Shipping Methods cURL error 7 Exception

Magento Version: 2.3.5p Hey guys, I am not sure if you have gotten a similar error during checkout: Internal Error. Details are available in Magento log file. Report ID: webapi-5ed2c83e06062 ...
user avatar
  • 33
0 votes
1 answer
117 views

Display curl result on phtml

I created a custom module to fetch data from an external API and I would like to display it on the frontend. I put my curl function in Helper\Data.php - Is it the best place to put it? I called ...
user avatar
0 votes
1 answer
118 views

How to display products with limits and offset

I have displaying products using following url host/index.php/rest/V1/products?searchCriteria[page_size]=20 Now displaying 20 products in page. i want 20 in first page, 20 to 40 products in second ...
user avatar
0 votes
1 answer
211 views

Product with image adding on magento2 using curl php. it shows error '{"message":"Specified request cannot be processed."}

json data body datas are.. "entry": { "id": 0, "media_type": "image", "label": "Image", "position": 1, "disabled": false, "...
user avatar
0 votes
1 answer
187 views

How to call CURL in magento 2 for curl_getinfo($ch, CURLINFO_HEADER_SIZE)

$ch = curl_init($url); $headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE); How to call in magento 2. I tried $this->_curl->setOption(CURLINFO_HEADER_SIZE);
user avatar
  • 1,324
1 vote
0 answers
101 views

Customer Logout using CURL request

I want to logout customer from external request based on the customer ID. For example, I have created custom controller action that accepts customer email in a GET request. I want to perform logout ...
user avatar
0 votes
1 answer
123 views

Magento 2 : Rest API error the requested URL returned error: 401

We have to test rest API is working or not in magento 2.3 but on my local project work only live site API not working. We have to check site open or not using curl but it's not working. I am not able ...
user avatar
  • 3,131
1 vote
1 answer
267 views

Curl OPTIONS request in Magento 2

I would like to do this request : curl -i -X OPTIONS my/url/path in Magento 2. This code works : $ch = curl_init(); curl_setopt_array($ch, array( CURLOPT_URL => 'my/url/path', ...
user avatar
  • 894
1 vote
1 answer
112 views

How to write this Curl code to Magento 2 code?

I am calling third party API using below methods: public function setCredentials($data) { $curl = curl_init('https://example_url.com/'); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($...
user avatar
  • 11
0 votes
1 answer
2k views

Upload local file to sever SFTP via curl php

I am trying to implement upload local file to server via sftp curl method but facing File upload error. Error number: 7. Here is my code. <?php $ourFileName = "/var/www/html/example.com/...
user avatar
0 votes
2 answers
1k views

how to use curl for external api call in magento 2

How do I make a post request with curl without using a button, but instead calling the external API when a field is filled out
user avatar
0 votes
1 answer
275 views

Magento 2 logout using curl

As per my requirement i want to logout the customer using PHP curl. for that I used the following code in my custom controller action(execute) $lastCustomerId = $this->_customerSession->getId()...
user avatar
  • 1,588
2 votes
0 answers
133 views

Algolia REST Api's to apply category, Price and Brand filters using PHP curl process on Algolia?

I Have sample curl code, It is working perfectly but I don't know, how to apply filters on category, price, and brands to get all products list. we are using algolia REST API's. $APPI_ID = "...
user avatar
  • 177
2 votes
0 answers
706 views

WorldPay Payment Integration using PHP and direct XML method curl API return blank page in Magento 2

I m trying to implement worldpay on a PHP site using XML direct method but whenever I try to connect I get blank pag.. Can you tell me were you testing the payment gateway on live site. Code: $...
user avatar
  • 1,389
2 votes
1 answer
1k views

Magento 2 GET API request to external api

In magento 1 you can make get request like this: First Authorizing object- public function authorize($url) { $cookie = $this->getCookieDir(); $user = $this->getApiUser(); $curl = ...
user avatar
  • 397
0 votes
1 answer
1k views

Magento 2 - Load Balancer - Health Check Failing - 302 redirect

I am having an issue with my load balancer health checks. It is attempting to access the server hosting the Magento 2 site. When I curl the IP address of the machine I get the following Response ...
user avatar
3 votes
1 answer
217 views

Why 2 classes Magento\Framework\HTTP\Client\Curl and Magento\Framework\HTTP\Adapter\Curl for same purpose?

Magento Framework has 2 classes for Curl operations: \Magento\Framework\HTTP\Adapter\Curl and \Magento\Framework\HTTP\Client\Curl What is specific use-case for each as both are capable of doing ...
user avatar
  • 1,474
0 votes
1 answer
249 views

Magento 1.9.2.4 cURL issue

I am using Magento 1.9.2.4 and my Magento Connect is not working. Whenever I click check for updates, everything from the bottom disappears, please check the image below: When I try to update Magento ...
user avatar
2 votes
1 answer
708 views

Magento 2 Curl Rest Endpoints

I'm trying to access the REST Endpoints: POST /V1/products/special-price POST /V1/products/special-price-information POST /V1/products/special-price-delete I want to achieve this through PHP code ...
user avatar
2 votes
0 answers
723 views

Magento2.2.2 Backend Curl CURLPROTO_HTTP undefined

This is an odd one: I've just updated my to macOS High Sierra installed missing extensions Frontend it's all good Backend Admin login fine But when logged in get Exepction: > 1 exception(s): ...
user avatar
2 votes
1 answer
1k views

Magento 2 Api/Data, When To Create It?

I have fairly simple REST API request to get guest country code by his ip. In my block file this works perfectly fine when using curl: $url = "http://........./".$guestIp."?access_key=".$...
user avatar
  • 397
0 votes
3 answers
821 views

Could not update password using customer ID in Magento-2 REST API

I am facing one issue. I am trying to update the customer password using Magento-2 REST API but the password could not update. I am explaining my code below. $adminUrl='http://domain.com/index.php/...
user avatar
  • 253
1 vote
1 answer
256 views

Magento2 : Getting error while updating the data using API

I am getting the following error while updating the record using the Magento 2 REST API. Error: ( [message] => Request does not match any route. [trace] => ) I am ...
user avatar
  • 11
2 votes
0 answers
31 views

curl is not operable because of some missing dependecies

Anybody know what it means this error message? And how to solve it? We want to install an extension for Full Page Cache in our Magento Store version 1.9.3. We use Apache Debian 9 for our server.
user avatar
  • 21
1 vote
3 answers
1k views

How to write Curl code to Magento 2 code

This is my curl code. How to write the same in Magento 2 $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, ...
user avatar
3 votes
3 answers
3k views

Magento 2 and ElasticSearch errors. Connection Failed. Test again?

i need some help with configuring my elastic search on magento 2.2.3 and i'm using ES 2.3. I login and configure here: Click Stores > Settings > Configuration > Catalog > Catalog > Catalog Search. ...
user avatar
0 votes
3 answers
2k views

Magento 2: convert curl response into array

I am not able to convert magento 2 JSON response into array. Can you please help in short out this problem? Here is my code: $url = 'http://example.com/api/coop'; $post = [ 'firstname' => ...
user avatar
0 votes
1 answer
355 views

Magento 2 : CURL Use in Observer

I am using event customer_register_success for sending customer detail to a third party website. I am facing problem in implementation of CURL in event observer. Do you have any example of using CURL ...
user avatar
1 vote
3 answers
2k views

How to list all products from API with curl command line?

I've been trying a lot of things and can't seem to figure out what should be pretty simple... How can I make a request with curl in command line to /index.php/rest/V1/products so that I simply get the ...
user avatar
0 votes
1 answer
5k views

Guide for API to third party application from inside Magento 2

The important questions i would like to know are: Can I call a CURL from inside a Model or ResourceModel? Is there any standardized way to handle API's to third party apps? Please keep in mind that, ...
user avatar
  • 387
0 votes
3 answers
5k views

SOLVED - Api token request Curl returns NULL

I am trying to get a token from my Magento 2 API, my script returns NULL, the call is working fine in Postman and generating a token : $adminUrl='https://www.xxxxxxx.com/rest/V1/integration/admin/...
user avatar
4 votes
2 answers
10k views

magento 2 : How to use curl? [duplicate]

I am trying to to create the curl request but it is not working. It is giving the error Uncaught Error: Class 'Custom\Rma\Helper\Varien_Http_Adapter_Curl' not found Code $header = array( ...
user avatar
  • 1,456
0 votes
1 answer
146 views

Unable to add product into cart from third party CURL

I have created custom controller in which I've written custom add to cart action and shared controller URL with 3rd party website. That website is calling my controller using CURL and on success, 3rd ...
user avatar
2 votes
4 answers
4k views

how to fix php curl extension error while installing magento 2

How to fix php curl extension error while installing magento 2? I attached the Screenshot
user avatar