TOPIC:

API call 1 year 3 months ago #243988

  • SHADOWSKY
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 38
  • Thanks: 0

TheMuffinMan wrote: Hi,

can you please post the current state of your code?
The above simply says there is a syntax error.

When you post the code, please use the forum's code tags.

Regards,
Markus


Here is the code:
// loading the BreezingForms API, mostly for using ff_getSubmit
$this->execPieceByName('ff_InitLib');

/**
   This is an example cURL rest api call from:
   https://tutorialsclass.com/php-rest-api-post-data-using-curl/
*/

// User data to send using HTTP POST method in curl

// data taken from the form:

$data = array('chassis'=>ff_getSubmit("chassis"));

// Data should be passed as json format
$data_json = json_encode($data);

// API URL to send data
$url = 'https://www.theipswebsite.com/api/tracking';

// curl initiate
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));

// SET Method as a POST
curl_setopt($ch, CURLOPT_POST, 1);

// Pass user data in POST command
curl_setopt($ch, CURLOPT_POSTFIELDS,$data_json);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

// Execute curl and assign returned data
$response  = curl_exec($ch);

// Close curl
curl_close($ch);

// See response if data is posted successfully or any error
// for debugging remove the comments
print_r ($response);
exit;

I only need to get the API code too, where do I put this one?

Please Log in or Create an account to join the conversation.

API call 1 year 3 months ago #243996

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 808
This code should go to form => advanced => more options => submit pieces => end submit => click "custom" => paste your code

After submit, you should see a white page with a response from the service.
Once everything works, you would remove the last 2 lines.

The code has no syntax errors by the way. Did you sort this out in the meanwhile?

Please Log in or Create an account to join the conversation.

API call 1 year 3 months ago #243998

  • SHADOWSKY
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 38
  • Thanks: 0

TheMuffinMan wrote: This code should go to form => advanced => more options => submit pieces => end submit => click "custom" => paste your code

After submit, you should see a white page with a response from the service.
Once everything works, you would remove the last 2 lines.

The code has no syntax errors by the way. Did you sort this out in the meanwhile?


Well this is the place where the code is and I get this error :(
I'm waiting for the API key from the supplier.

Please Log in or Create an account to join the conversation.

API call 1 year 3 months ago #244002

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 808
did you probably paste this with opening and closing php tags?
if yes, then please don't use these.

Please Log in or Create an account to join the conversation.

API call 1 year 3 months ago #244008

  • SHADOWSKY
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 38
  • Thanks: 0

TheMuffinMan wrote: did you probably paste this with opening and closing php tags?
if yes, then please don't use these.

No php tags are present it is just the code which I've pasted above.

Please Log in or Create an account to join the conversation.

API call 1 year 3 months ago #244040

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 808
Ok, looks like there is a bug when parsing the pieces code (one of the CURLOPT values are replaced).

Please download and install the component attached (just install over). It should fix the problem will be available with the next update.

Regards,
Markus
Attachments:

Please Log in or Create an account to join the conversation.

Moderators: ForumSupport
Time to create page: 0.053 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!