ballhogjoni Posted January 14, 2007 Share Posted January 14, 2007 I am sending this information to another server. For some reason the other server cannot read my $ccnumber variable. Any help would be appreciated.[code]//code startmysql_connect(localhost,$username,$password);@mysql_select_db($database) or die( "Unable to select database");$result = mysql_query("SELECT first, last, email, address, city, state, zipcode, phone FROM articlecash ORDER BY id DESC");$result2 = mysql_query("SELECT ccnumber, expyear, expmonth FROM articlecashccinfo ORDER BY id DESC");$result1 = mysql_fetch_array($result);$result3 = mysql_fetch_array($result2);mysql_close();$phone = $result1['phone'];$first = $result1['first'];$last = $result1['last'];$email = $result1['email'];$address = $result1['address'];$city = $result1['city'];$state = $result1['state'];$zipcode = $result1['zipcode'];$ccnumber = $result3['ccnumber'];$expyear = $result3['expyear'];$expmonth = $result3['expmonth'];$username = 'XXXXXX'; $password = 'XXXXXX'; $command = "user.configure";$user_id = "NEW";$url = "https://www.XXXXXX.com/auto/api.php?partner_login=$username&partner_password=$password&test=TRUE&command=$command&user_id=$user_id&service=\"code=DS,frequency=M,action=add,renewal_billed_to=U,trial=14\"&output=php&phone=$phone&first_name=$first&last_name=$last&bill_address1=$address&bill_address2=&bill_city=$city&bill_state=$state&bill_postal=$zipcode&bill_country=US&username=foousername&password=foopassword&cc_num=$ccnumber&cc_exp=$expyear-$expmonth&email=$email";$ch = curl_init();curl_setopt( $ch , CURLOPT_URL , $url); //the url curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable curl_setopt($ch, CURLOPT_TIMEOUT, 3); // times out after 4s curl_setopt($ch, CURLOPT_POST, 1); // set POST method$ret = curl_exec($ch); curl_close($ch); echo $ret;?>// code end[/code] Quote Link to comment Share on other sites More sharing options...
Orio Posted January 14, 2007 Share Posted January 14, 2007 You've set:curl_setopt($ch, CURLOPT_POST, 1);But you didnt send any post information using CURLOPT_POSTFIELDS, you've only sent GET data (in the URL itself).I think you meant doing:[code]<?phpmysql_connect(localhost,$username,$password);@mysql_select_db($database) or die( "Unable to select database");$result = mysql_query("SELECT first, last, email, address, city, state, zipcode, phone FROM articlecash ORDER BY id DESC");$result2 = mysql_query("SELECT ccnumber, expyear, expmonth FROM articlecashccinfo ORDER BY id DESC");$result1 = mysql_fetch_array($result);$result3 = mysql_fetch_array($result2);mysql_close();$phone = $result1['phone'];$first = $result1['first'];$last = $result1['last'];$email = $result1['email'];$address = $result1['address'];$city = $result1['city'];$state = $result1['state'];$zipcode = $result1['zipcode'];$ccnumber = $result3['ccnumber'];$expyear = $result3['expyear'];$expmonth = $result3['expmonth'];$username = 'XXXXXX'; $password = 'XXXXXX'; $command = "user.configure";$user_id = "NEW";$url = "https://www.XXXXXX.com/auto/api.php";$ch = curl_init();curl_setopt( $ch , CURLOPT_URL , $url); //the url curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable curl_setopt($ch, CURLOPT_TIMEOUT, 3); // times out after 4s curl_setopt($ch, CURLOPT_POST, 1); // set POST methodcurl_setopt($ch, CURL_POSTFIELDS, "partner_login=$username&partner_password=$password&test=TRUE&command=$command&user_id=$user_id&service=\"code=DS,frequency=M,action=add,renewal_billed_to=U,trial=14\"&output=php&phone=$phone&first_name=$first&last_name=$last&bill_address1=$address&bill_address2=&bill_city=$city&bill_state=$state&bill_postal=$zipcode&bill_country=US&username=foousername&password=foopassword&cc_num=$ccnumber&cc_exp=$expyear-$expmonth&email=$email");$ret = curl_exec($ch); curl_close($ch); echo $ret;?>[/code]I must mention that you should use urlencode() on the data you are sending. You can have a few problems if you dont use it.Orio. Quote Link to comment Share on other sites More sharing options...
ballhogjoni Posted January 14, 2007 Author Share Posted January 14, 2007 I thought the same thing. the other server says I am forgetting "code=2&text=Parameter+Missing%3A+partner_login%2Cpartner_password%2Ccommand&version=3.0"The code I have works if I manually put a credit card number in the place of $ccnumber. Example: &cc_num=411111111111111&So my question is How come my variable is not being read in the url string. Quote Link to comment Share on other sites More sharing options...
ballhogjoni Posted January 15, 2007 Author Share Posted January 15, 2007 anyone else have any ideas Quote Link to comment Share on other sites More sharing options...
ballhogjoni Posted January 15, 2007 Author Share Posted January 15, 2007 I wonder if anyone knows. Quote Link to comment Share on other sites More sharing options...
ballhogjoni Posted January 15, 2007 Author Share Posted January 15, 2007 nevermind I figured it out Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.