by Urdhva Tech

Need a landing page for your next campaign? A way for your customers to create support cases? Do your sales reps need a way to enter leads? With WebToModule you can create custom webforms for these any many other users. Supports all modules, including custom modules.

Includes a 30 day guarantee
Try it Now

#2663 - Sending information with cURL or Angular

Closed Feature created by PabloPimas 4 years ago

Hello:

We would need to know how to send the form data with a post request using cURL. Currently the lead capture form does not use the action attribute of the form as it performs other tasks before being submitted. That is why we need to send the information by a post request.

We have built the following PHP cURL post request on our server: the form data is delivered by angular in JSON format and decoded into $data variable but we don't receive any lead in leads module.

    $ URL = "our url";     $ USER = "Mozilla / 5.0 (Macintosh; Intel Mac OS X 10.9; rv: 50.0) Gecko / 20100101 Firefox / 50.0";     $ ENC = "Content-type: multipart / form-data"; $ handler = curl_init ($ URL);

$formdata = file_get_contents("php://input");
$data     = json_decode($formdata);

$lead is an array with the fields in format: 'field' => value, where value is: $value = $data->field

    curl_setopt ($ handler, CURLOPT_USERAGENT, $ USER);     curl_setopt ($ handler, CURLOPT_HTTPHEADER, [$ ENC]);     curl_setopt ($ handler, CURLOPT_CONNECTTIMEOUT, 100);     curl_setopt ($ handler, CURLOPT_SSL_VERIFYPEER, false);     curl_setopt ($ handler, CURLOPT_RETURNTRANSFER, true);     curl_setopt ($ handler, CURLOPT_HEADER, true);     curl_setopt ($ handler, CURLOPT_POST, true);     curl_setopt ($ handler, CURLOPT_POSTFIELDS, $ lead);

    # SEND THE REQUEST

    $ post_data = curl_exec ($ handler);

    # CURL CLOSURE

    curl_close ($ handler);

Thank you Best regards Pablo Pimas Likuid Europe

  1. urdhvatech member avatar

    Urdhva Tech Provider Affiliate

    4 years ago

    Hello Pablo Pimas,

    Thank you for contacting us. But i think this question doesn't related to our add-on. The right place to ask general development question is the SuiteCRM forum.

    Do let me know if you have any further question.

    Thanks & Regards, Team Urdhva Tech

This case is public. Please leave out any sensitive information such as URLs, passwords, etc.
Saving Comment Saving Comment...
Rating
  • "The team at Urdhva Tech are very responsive. I emailed with some queries and within the day they replied with a suggestion. They provided a custom cha..." - peter4

    Read More Reviews