Skip to Content Skip to Menu

[SOLVED] Need assistance debugging PHP trigger in CB Auto Actions

10 years 7 months ago - 10 years 7 months ago #243120 by prestoproducts
I am working on a script which will update a master server using cURL through a PHP CB Auto Action trigger. As you will see in the code sample below I am pulling a variety of CB user fields and posting them to the HTTPS urls. I have tested each cURL script individually and they work fine. THe issue is that when I put them back to back as you can see here only the first script is functioning.
Code:
$rdcno = rawurlencode('[cb_rdcno]'); $fname = rawurlencode('[firstname]'); $lname = rawurlencode('[lastname]'); $address1 = rawurlencode('[cb_addressline1]'); $city = rawurlencode('[cb_city]'); $state = rawurlencode('[cb_state]'); $zipcode = rawurlencode('[cb_zip]'); $cancel_date = date('Y-m-d'); $curl = curl_init(); curl_setopt($curl, CURLOPT_VERBOSE, 1); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($curl, CURLOPT_TIMEOUT, 30); curl_setopt($curl, CURLOPT_URL, 'https://mysite.com/integration.php?type=CANCEL&rdcnumber='.$rdcno.'&cancel_date='.$cancel_date.''); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $Response = curl_exec($curl); return $Response; curl_close($curl); $curl2 = curl_init(); curl_setopt($curl2, CURLOPT_VERBOSE, 1); curl_setopt($curl2, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($curl2, CURLOPT_TIMEOUT, 30); curl_setopt($curl2, CURLOPT_URL, 'https://mysite.com/service.php?customer_id='.$rdcno.'&siteid=LMCU-TEST&name_first='.$fname.'&middle_name=-&name_last='.$lname.'&address='.$address1.'&city='.$city.'&state='.$state.'&zip='.$zipcode.'&type=CANCEL'); curl_setopt($curl2, CURLOPT_RETURNTRANSFER, 1); $Response2 = curl_exec($curl2); return $Response2; curl_close($curl2);

Any idea why this configuration is not working for both of these scripts at the same time?
Last edit: 10 years 7 months ago by krileon.

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

10 years 7 months ago #243122 by prestoproducts
Solved it... If anyone else is having this trouble, see:

us2.php.net/manual/en/function.curl-multi-exec.php

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

  • nant
  • nant
  • OFFLINE
  • Posts: 12339
  • Thanks: 1467
  • Karma: 877
10 years 7 months ago #243124 by nant
Cool - thanks for sharing these nice use cases.

Perhaps you can post back the corrected script?

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

Moderators: beatnantkrileon
Powered by Kunena Forum