Archived Forum Post

Index of archived forum posts

Question:

Posting large json with curl

Aug 09 '17 at 12:06

Hi, i want to reproduce this curl request (PHP) with chilkat in vb.net

$parameters = array( 'action' => 'import', 'controller' => 'Defect', ); $url .= '&'.http_build_query(array('tx_itkdefectdetector_frontend' => $parameters)); $curlArray = array( CURLOPT_POST => 1, CURLOPT_POSTFIELDS => array('tx_itkdefectdetector_frontend[jsonData]'=>$jsonData), CURLOPT_FOLLOWLOCATION => 1, CURLOPT_HEADER => 0, CURLOPT_RETURNTRANSFER => 1, CURLOPT_TIMEOUT => 10, CURLOPT_VERBOSE => 1, ); $curl = curl_init($url); curl_setopt_array($curl, $curlArray);

the url is something like this

https://mm.itk-rheinland.de/index.php?id=4&type=xxxxxxx&tx_itkdefectdetector_frontend[actio n]=import&tx_itkdefectdetector_frontend[controller]=Defect&tx_itkdefectdetector_frontend[jsonD ata]={jsonData}

The json is in string form, but can have image data (base64_encode)m included in the post, so it becomes to long for an URL request.

Can someone point me to the correct way posting it from code in vb.net

THX

Martin


Answer

See this example:

https://www.example-code.com/vbnet/http_postUrlEncoded.asp

Set each of the request query params by calling req.AddParam, including the case for the large JSON document.