ballhogjoni Posted March 28, 2007 Share Posted March 28, 2007 How do you stop this from printing to a browser? a:5:{s:8:"username";s:13:"[email protected]";s:7:"user_id";s:2:"-1";s:4:"code";i:0;s:4:"text";s:33:"API Command executed Successfully";s:7:"version";s:3:"3.0";} This is my code: <?php session_start(); $_SESSION['first']; $_SESSION['last']; $_SESSION['email'] = $_POST['email']; $_SESSION['address'] = $_POST['address']; $_SESSION['city'] = $_POST['city']; $_SESSION['state'] = $_POST['state']; $_SESSION['zipcode'] = $_POST['zipcode']; $_SESSION['areacode'] = $_POST['areacode']; $_SESSION['prefix'] = $_POST['prefix']; $_SESSION['linenumber'] = $_POST['linenumber']; $_SESSION['Iagree'] = $_POST['Iagree']; ?> <?php $username="xxxx"; $password="xxxx"; $database="xxxx"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query = "INSERT INTO eBayoffers_info_1 VALUES ('','".$_SESSION['email']."','".$_SESSION['first']."','".$_SESSION['last']."','".$_SESSION['address']."','".$_SESSION['city']."','".$_SESSION['state']."','".$_SESSION['zipcode']."','".$_SESSION['areacode']."','".$_SESSION['prefix']."','".$_SESSION['linenumber']."','".$_SESSION['Iagree']."')"; mysql_query($query); mysql_close(); $ccnumber=$_POST['ccnumber']; $expmonth=$_POST['expmonth']; $expyear=$_POST['expyear']; $first = rawurlencode($_SESSION['first']); $last = rawurlencode($_SESSION['last']); $email = rawurlencode($_SESSION['email']); $areacode = rawurlencode($_SESSION['areacode']); $prefix = rawurlencode($_SESSION['prefix']); $linenumber = rawurlencode($_SESSION['linenumber']); $phone = $areacode.$prefix.$linenumber; $address = rawurlencode($_SESSION['address']); $city = rawurlencode($_SESSION['city']); $state = $_SESSION['state']; $zipcode = rawurlencode($_SESSION['zipcode']); $username = 'xxxx'; $password = 'xxxx'; $command = "user.configure"; $user_id = "NEW"; $url = "https://www.xxxx.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=7\"&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 $ret = curl_exec($ch); /*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 */ curl_close($ch); ?> <html> <head> <meta http-equiv="refresh" content=".0;url=/xx/xxx/xxx.php"> </head> <body> </body> </html> I think it has something to do with the CURL script. Link to comment https://forums.phpfreaks.com/topic/44691-solved-stop-a-string-from-printing-to-a-browser/ Share on other sites More sharing options...
per1os Posted March 28, 2007 Share Posted March 28, 2007 here is one way: <?php session_start(); $_SESSION['first']; $_SESSION['last']; $_SESSION['email'] = $_POST['email']; $_SESSION['address'] = $_POST['address']; $_SESSION['city'] = $_POST['city']; $_SESSION['state'] = $_POST['state']; $_SESSION['zipcode'] = $_POST['zipcode']; $_SESSION['areacode'] = $_POST['areacode']; $_SESSION['prefix'] = $_POST['prefix']; $_SESSION['linenumber'] = $_POST['linenumber']; $_SESSION['Iagree'] = $_POST['Iagree']; ?> <?php $username="xxxx"; $password="xxxx"; $database="xxxx"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query = "INSERT INTO eBayoffers_info_1 VALUES ('','".$_SESSION['email']."','".$_SESSION['first']."','".$_SESSION['last']."','".$_SESSION['address']."','".$_SESSION['city']."','".$_SESSION['state']."','".$_SESSION['zipcode']."','".$_SESSION['areacode']."','".$_SESSION['prefix']."','".$_SESSION['linenumber']."','".$_SESSION['Iagree']."')"; mysql_query($query); mysql_close(); $ccnumber=$_POST['ccnumber']; $expmonth=$_POST['expmonth']; $expyear=$_POST['expyear']; $first = rawurlencode($_SESSION['first']); $last = rawurlencode($_SESSION['last']); $email = rawurlencode($_SESSION['email']); $areacode = rawurlencode($_SESSION['areacode']); $prefix = rawurlencode($_SESSION['prefix']); $linenumber = rawurlencode($_SESSION['linenumber']); $phone = $areacode.$prefix.$linenumber; $address = rawurlencode($_SESSION['address']); $city = rawurlencode($_SESSION['city']); $state = $_SESSION['state']; $zipcode = rawurlencode($_SESSION['zipcode']); $username = 'xxxx'; $password = 'xxxx'; $command = "user.configure"; $user_id = "NEW"; $url = "https://www.xxxx.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=7\"&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"; ob_start(); $ch = curl_init(); curl_setopt( $ch , CURLOPT_URL , $url); //the url $ret = curl_exec($ch); /*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 */ curl_close($ch); ob_end_clean(); ?> <html> <head> <meta http-equiv="refresh" content=".0;url=/xx/xxx/xxx.php"> </head> <body> </body> </html> See if that works. Used functions ob_start() and ob_end_clean() Link to comment https://forums.phpfreaks.com/topic/44691-solved-stop-a-string-from-printing-to-a-browser/#findComment-217060 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.