Jump to content

cURL Issue


johnnybenimble

Recommended Posts

Hi,

 

I am trying to post to a REST service using PHP cURL but I'm after running into a bit of difficulty (this being that I've never used cURL before!!).

 

I've put together this code:

 

 

$url = 'http://127.0.0.1:00/AccountCreator.ashx'; /*Where :00 represents the port number */$curl_post_data = array(    'companyName' =>urlencode($companyName),    'mainContact' =>urlencode($mainContact),    'telephone1' =>urlencode($telephone1),    'email' => urlencode($email),    'contact2' => urlencode($contact2),    'telephone2' => urlencode($telephone2)    'email2' => urlencode($email2);    'package' => urlencode($package)    );foreach($curl_post_data as $key=>$value) {$fields_string .=$key. '=' .$value.'&';}rtrim($fields_string, '&');$ch = curl_init();curl_setopt ($ch, CURLOPT, $url);curl_setopt ($ch, CURLOPT_POST, count($curl_post_data));curl_setopt ($ch, CURLOPT_POSTFIELDS, $fields_string);$result = curl_exec($ch);curl_close($ch);

 

I've tried this however it doesn't run. As I am integrating with payment partners, it just says:

 

 

Your transaction has been successful but there was a problem connecting back to the merchant's web site. Please contact the merchant and advise them that you received this error message. Thank you.

 

I have emailed them to find out the exact error, but in the mean time I was wondering could someone take a look at my code to eliminate this as a problem, if possible.

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/214512-curl-issue/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.