No announcement yet.

Using sc_webservice for cURL

  • Filter
  • Time
  • Show
Clear All
new posts

  • Using sc_webservice for cURL

    I'm trying to use an online service that responds to calls structured this way:

    curl -i -k -3 -X POST https://full_url
    -H "some-headervalue: value" \
    -d '{ "field1":"val1","field2":"val2" }'

    I've followed the Netmake sample setting field1 and field2 in the parms array and called sc_webservice replacing 80 with 443 for https. Soemthing like this:

    $parms['field1'] = 'val1';
    $parms['field2'] = 'val2';
    $parms = http_build_query($parms);

    $resposta = sc_webservice("curl", "https://full_url", 443, "POST", $parms, array(CURLOPT_RETURNTRANSFER => true,CURLOPT_HEADER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSLVERSION => 3, CURLOPT_HTTPHEADER => "some-headervalue: value"), 30, true);

    Nothing happens. Looking at the console response I see something like this "curl_setopt(): You must pass either an object or an array with the CURLOPT_HTTPHEADER, CURLOPT_QUOTE, CURLOPT_HTTP200ALIASES and CURLOPT_POSTQUOTE arguments..."

    Can someone guide me in correct usage?
    Last edited by scriptcaser; 08-29-2015, 06:21 PM.

  • #2
    I am not using this sc_webservice myself. On the other hand the normal standard php webservice routines work totally fine, we are using it ourselves.
    I see little reason to use sc_webservice.
    See here: