php - Posting to XML with cURL, Noob here learning -


hi i'm trying program curl. haven't started return me wit server internal error. there wrong given code in curl?

<?php'; $now = new datetime(); $url = "smsx.ia.com.my"; $parameters = array( 'userid' => 'something@gmail..com', 'version' => '1.0', 'action' => 'productcreate', 'timestamp' => $now->format(datetime::iso8601), ); // sort parameters name ksort($parameters); $params = array(); foreach ($parameters $name => $value) { $params[] = rawurlencode($name) . '=' . rawurlencode($value); } $strtosign = implode('&', $params); // compute signature , add parameters $parameters['signature'] = rawurlencode(hash_hmac('sha256', $strtosign, $api_key, false));  // build query string $querystring = http_build_query($parameters, '', '&', php_query_rfc3986); // open curl connection $ch = curl_init(); curl_setopt($ch, curlopt_url, $url."?".$querystring); // save response variable $data curl_setopt($ch, curlopt_followlocation,1); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_postfields, $xmlpayload); $data = curl_exec($ch); // close curl connection curl_close($ch);  if (isset($_post['submit'])) {   }  ?>  <form action="" method="post">  <input type="submit"> </form> 

so i'm trying post information url, load site , gives me system internal error. can't proceed it.

any idea why i'm facing issue?

first of all, if posting xml data have specify server sending xml in post data. can't see in code.

curl_setopt($ch, curlopt_httpheader, array('content-type: application/xml; charset=utf-8')); 

secondly, make sure preparing $querystring thing correctly. otherwise may raise internal server error too.

finally, curious, sure '; after <?php @ first line of code?


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -