Change status of email at contact area from non marketable to unconfirmed

Dear sir,
I trying the change status of email at contact area from non marketable to unconfirmed.
I used the below method but received invalid key from Infusionsoft.
I hope to get some help on this

<?php ###Include our XMLRPC Library### include("xmlrpc-2.0/lib/xmlrpc.inc"); ###Set our Infusionsoft application as the client### $client = new xmlrpc_client("https://mach2.infusionsoft.com/api/xmlrpc"); ###Return Raw PHP Types### $client->return_type = "phpvals"; ###Dont bother with certificate verification### $client->setSSLVerifyPeer(FALSE); ###Our API Key### $key = "****************************************"; function updateEmailStatus() { global $client, $key; $email = 'welcome@test.com'; $reason ='Unconfirmed'; ###Set up the call### $call = new xmlrpcmsg("APIEmailService.optIn", array( php_xmlrpc_encode($key), #The encrypted API key php_xmlrpc_encode($email), #The table to add the record to. php_xmlrpc_encode($reason), #The Credit Card Data )); ###Send the call### $result = $client->send($call); if(!$result->faultCode()) { $cardID = $result->value(); print "Email Status Update: " . $email; print "
"; } else { print $result->faultCode() . "
"; print $result->faultString() . "
"; } return $email; } $info = updateEmailStatus(); ?>

i’ve posted your code below for clear view, this is outdated script use new latest REST method or PHP SDK

<?php
    ###Include our XMLRPC Library###
    include("xmlrpc-2.0/lib/xmlrpc.inc");

    ###Set our Infusionsoft application as the client###

    $client = new xmlrpc_client("https://mach2.infusionsoft.com/api/xmlrpc");

    ###Return Raw PHP Types###
    $client->return_type = "phpvals";

    ###Dont bother with certificate verification###
    $client->setSSLVerifyPeer(FALSE);

    ###Our API Key###
    $key = "****************************************";

    function updateEmailStatus() {
    	global $client, $key;
        $email = 'welcome@test.com';
    $reason ='Unconfirmed';    

    ###Set up the call###
    	$call = new xmlrpcmsg("APIEmailService.optIn", array(
    		php_xmlrpc_encode($key), 		#The encrypted API key
    		php_xmlrpc_encode($email),	#The table to add the record to.
    		php_xmlrpc_encode($reason),			#The Credit Card Data
    	));
    ###Send the call###
    	$result = $client->send($call);

    	if(!$result->faultCode()) {
    		$cardID = $result->value();
    		print "Email Status Update: " . $email;
    		print "";
    	} else {
    		print $result->faultCode() . "";
    		print $result->faultString() . "";
    	}
    	return $email;
    }
    $info = updateEmailStatus();
    ?>