php - cURL POST to REST Service -


I am trying to post on a REST service using PHP curls, but I'm running in a little hard I am (that I have never used curls before !!).

I put this code together:

  & lt ;? Php error_reporting (E_ALL); If ($ result == "00") {$ url = 'http://127.0.0.1/xxxxxx/AccountCreator.ashx'; / * I have tried a combination of ways to look at it which * / $ curl_post_data = array ('companyname' = & gt; urlencode ($ companyName), 'main contact' = & gt; urlencode ($ mainContact), 'Telephone1' = & gt; urlencode ($ telephone1), 'email' = & gt; urlencode ($ email), 'contact2' = & gt; urlencode ($ contact2), 'telephone2' = & gt; urlencode ($ Telephone2) 'email2' => Urlencode ($ email2); 'package' = & gt; urlencode ($ package); Forex currency ($ curl_post_data $ key = & gt; $ value) {$ fields_string = $ Key '=' $ Value '& Amp;'; } Rtrim ($ fields_string, '& amp;'); Die ("Test:". $ Fields_string); $ Ch = curl_init (); Curl_setopt ($ CH, CURLOPT, $ url); Curl_setopt ($ ch, CURLOPT_POST, calculation ($ curl_post_data)); Curl_setopt ($ CH, CURLOPT_POSTFIELDS, $ fields_string); $ Result = curl_xac ($ CH); Curl_close ($ ch);  

After this, my code sends an email and the IF statement does. I know that this work is fine, I started walking in trouble only when I tried to include this QR request.

I tried to do it but it did not work. As I am integrating with payment partners, it just says:

  Your transaction has been successful but there was a problem connecting the merchant's web site, please contact the dealer And advise them that you have received this error message. Thank you.  

The exact error received was an HTTP 500 error.

Thank you. {$ Fields_string}

foreach ($ curl_post_data $ key = & gt; value) . = $ Key '=' .value. '& Amp;';

The price here is a dollar that I think

  foreach ($ curl_post_data $ key = & gt; $ value) {$ fields_string = $ Key '=' $ Value '& Amp;';  

To see if you are actually sending the merchant to die ($ fields_string); has tried


Comments