Jump to content
Sign in to follow this  
Alice

Curl inside the code

Recommended Posts

Hello,

 

I want include a payment module and need to use CURL. I am looking the class inside ClicShopping, but I do not find a function like that.
Before to implement something, maybe someone can tell if it exist.

Thank you.

Share this post


Link to post
Share on other sites

Hello @Alice,

 

Curl is now managed by GuzzleClient, inside HTTP you have 2 functions

HTTP::getResponse() and HTTP:setResponseCode()

If you do not want to use this approach, you can make the traditionnal CURL code.

 

Share this post


Link to post
Share on other sites

Just an example found inside the paypal module

 

  public function makeApiCall($url, $parameters = null, array $headers = null)
    {
      $server = parse_url($url);

      $p = ['url' => $url,
        'parameters' => $parameters,
        'headers' => $headers
      ];

      if ((substr($server['host'], -10) == 'paypal.com')) {
        $p['cafile'] = CLICSHOPPING::BASE_DIR . 'Apps/Payment/PayPal/work/paypal.com.crt';
      }

      return HTTP::getResponse($p);
    }

$p must be inside an array with these elements :

$parameters url, headers, parameters, method, verify_ssl, cafile, certificate, proxy

 

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use