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
1 answer
352 views

How to use curl in magento 2 method?

I have a curl script to send sms. Below is the code. $userId = $this->gupShupConfig->getSenderUsername(); $password = $this->gupShupConfig->getSenderPassword(); $smsApiUrl = $this-&...
Mujahidh's user avatar
  • 2,671
1 vote
1 answer
700 views

Bad Request Your browser sent a request that this server could not understand

I am trying to make get an oauth acces token from magento but when i sent the data i receive this error. Bad Request Your browser sent a request that this server could not understand This is the ...
Lucas de Rijke's user avatar
0 votes
1 answer
308 views

Magento2 - How to pass query parameter in curl get method

I have a curl request example, it is working once I'm checking it with command line. curl https://api.stripe.com/v1/payment_intents/search -u secret key: --data-urlencode query="status:'...
Suresh Chikani's user avatar
0 votes
1 answer
263 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); ...
imtiaz's user avatar
  • 3
0 votes
1 answer
144 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....
mierzej91's user avatar
2 votes
1 answer
179 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
Asssd's user avatar
  • 210
0 votes
0 answers
290 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 ...
Wwwww's user avatar
  • 1
0 votes
0 answers
528 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/...
A. Fletcher's user avatar
0 votes
1 answer
349 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 ...
cnu's user avatar
  • 345
0 votes
0 answers
116 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 ...
Carter's user avatar
  • 47
0 votes
1 answer
1k 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" => "...
Prits's user avatar
  • 626
0 votes
0 answers
280 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' ...
Zyzzx's user avatar
  • 81
0 votes
1 answer
30 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 ...
Mike.Bean's user avatar
0 votes
1 answer
189 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 ...
Anis Agrebi's user avatar
0 votes
1 answer
781 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\\...
Attila Naghi's user avatar
  • 3,863
2 votes
1 answer
612 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 ...
Reshad Zazai's user avatar
1 vote
1 answer
435 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(...
Rutu Shah's user avatar
0 votes
1 answer
333 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-&...
Dominic Pixie's user avatar
0 votes
1 answer
499 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 ...
J W's user avatar
  • 33
0 votes
1 answer
172 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 ...
Tony Le's user avatar
0 votes
1 answer
360 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 ...
dhviya mishral's user avatar
0 votes
1 answer
322 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, "...
dhviya mishral's user avatar
0 votes
1 answer
324 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);
jassi's user avatar
  • 1,344
1 vote
0 answers
138 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 ...
Ahsan Horani's user avatar
0 votes
1 answer
246 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 ...
Devidas's user avatar
  • 3,298
1 vote
1 answer
717 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', ...
Kozame's user avatar
  • 954
1 vote
1 answer
143 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($...
Ben's 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/...
Sanjay Jethva's user avatar
0 votes
3 answers
2k 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
Adam Scott's user avatar
0 votes
1 answer
395 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()...
senthil's user avatar
  • 1,707
2 votes
1 answer
195 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 = "...
P Ramulu's user avatar
  • 177
2 votes
0 answers
924 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: $...
Divya Sekar's user avatar
  • 1,441
2 votes
1 answer
2k 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 = ...
Trenox's user avatar
  • 397
0 votes
1 answer
2k 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 ...
Shawn Northrop's user avatar
3 votes
1 answer
549 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 ...
Milind Singh's user avatar
  • 1,554
0 votes
1 answer
304 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 ...
Ali Kamran's user avatar
2 votes
1 answer
917 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 ...
A. Fletcher's user avatar
2 votes
0 answers
994 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): ...
Juliano Vargas's user avatar
2 votes
1 answer
2k 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=".$...
Trenox's user avatar
  • 397
0 votes
3 answers
902 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/...
satya's user avatar
  • 253
1 vote
1 answer
344 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 ...
satya's user avatar
  • 11
2 votes
0 answers
32 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.
jenmos's user avatar
  • 21
1 vote
3 answers
2k 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, ...
Rama Chandran M's 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. ...
Head's user avatar
  • 125
0 votes
3 answers
3k 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' => ...
Pankaj Sharma's user avatar
0 votes
1 answer
453 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 ...
Pankaj Sharma's 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 ...
Florian310's 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, ...
Midlaj's user avatar
  • 397
1 vote
3 answers
6k 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/...
Ismail Berlin's user avatar
4 votes
2 answers
12k 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( ...
Nitin Pawar's user avatar
  • 1,526