Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

JSON & .NET C#

$
0
0

Hello,

Iam trying to consum a json web service. 

The doc api gives an exemple in php, i try to use c# and don't find the code to use for post HTTP. (with GET it works fine).

bellow php code (doc exemple)

<?php $universe = 'XXXX'; $pass = 'XXXXXXXXXXXXXXXXXXXXXXX'; $service_url = 'https://*XXXXXXXXX/XXX-5.pl'; // Build a json array of recipient using data from DB or csv file $rcpts = array ( array ( 'email' => 'test@customer.com', 'firstname' => 'John', 'lastname' => 'Doe', 'c0' => '123456' ), array ( 'email' => 'test2@customer.com', 'firstname' => 'Jane', 'lastname' => 'Doe', 'c0' => '123457' ), ); // declare other sending parameters $params = array( 'universe' => $universe, // your universe 'key' => $pass, // your secret key 'opcode' => 'XXXXX', // operation code to be used 'message' => 'XXXXXXX', // EF4 message id 'rcpts' => json_encode($rcpts), // recipients ); // encode all parameters including JSON array $url = $service_url . '?'. http_build_query($params); 5 Trigger documentation Splio development Team // API call using curl library $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); // turn of SSL check just for the example. curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); // can solve problems with curl curl_setopt($curl, CURLOPT_HTTPHEADER,array("Expect:")); // actual call $curl_response = curl_exec($curl); curl_close($curl); // print the server response var_dump($curl_response); // and the json received var_dump(json_decode($curl_response, true)) ?>

any one have an idea?

ty


"Le temps c'est de la monnaie"


Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>