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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.