Jump to content

johnnybenimble

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

johnnybenimble's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you very much. This was obviously my mistake. I got a HTTP 400 error with this, but at least it's an error to actually go on.
  2. Apologies, it was further up in the code, I just wanted to post a snippet. $companyName = $_POST['COMPNAME']; $mainContact = $_POST['MAINCONTACT']; $telephone1 = $_POST['TELEPHONE']; $email = $_POST['EMAIL']; $contact2 = $_POST['SECONDCONTACT']; $telephone2 = $_POST['TELEPHONE2']; $email2 = $_POST['EMAIL2']; $package = $_POST['PACKAGE']; The reason for the dollar symbols - the creator of the web service is looking for these. I have tested the output with die("Test: ".$fields_string); and it shows the correct output that I require so I'm thinking it's not a problem with the code?
  3. Hi guys, I was wondering if you could help me. I have this code which should send a call to a RESTful web service (which creates a new user in a database). My code is executing without any errors (that I can see) however the user doesn't get created. $url = 'http://127.0.0.1:85/AccountCreator.ashx'; $curl_post_data = array( '$companyName' =>$companyName, '$mainContact' =>$mainContact, '$telephone1' =>$telephone1, '$email' => $email, '$contact2' => $contact2, '$telephone2' => $telephone2, '$email2' => $email2, '$package' => $package ); foreach($curl_post_data as $key=>$value) {$fields_string.=$key. '=' .$value.'&'; } rtrim($fields_string, '&'); //die("Test: ".$fields_string); $ch = curl_init(); curl_setopt ($ch, CURLOPT, $url); curl_setopt ($ch, CURLOPT_POST, true); curl_setopt ($ch, CURLOPT_POSTFIELDS, $fields_string); $result = curl_exec($ch); curl_close($ch); I'm fairly new to PHP also, so I just can't see where I'm doing wrong. I have access to the server also - is there anything I can check on that which would indicate if the web service is being called or not? I've also read this in http://php.net/manual/en/function.curl-setopt.php... I don't think my PHP document is set to multipart/form-data - Would this affect it? I have also tried it like this with the port number, $url = 'http://127.0.0.1/AccountCreator.ashx'; $curl_post_data = array( '$companyName' =>$companyName, '$mainContact' =>$mainContact, '$telephone1' =>$telephone1, '$email' => $email, '$contact2' => $contact2, '$telephone2' => $telephone2, '$email2' => $email2, '$package' => $package ); foreach($curl_post_data as $key=>$value) {$fields_string.=$key. '=' .$value.'&'; } rtrim($fields_string, '&'); //die("Test: ".$fields_string); $ch = curl_init(); curl_setopt ($ch, CURLOPT, $url); curl_setopt ($ch, CURLOPT_PORT , 85); curl_setopt ($ch, CURLOPT_POST, true); curl_setopt ($ch, CURLOPT_POSTFIELDS, $fields_string); $result = curl_exec($ch); curl_close($ch);
  4. I've just got word from our payment partners, the error was a HTTP 500 error.
  5. 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: 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.
×
×
  • 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.