'getavatardata', 'group' => $GROUP, 'password' => $PASSWORD, 'agent' => $_POST['id'], 'data' => 'VisualParameters' ); # We now escape each key and value: this is very important, because the # data we send to Corrade may contain the '&' or '=' characters (we don't # in this example though but this will not hurt anyone). array_walk($params, function(&$value, $key) { $value = urlencode($key)."=".urlencode($value); } ); $postvars = implode('&', $params); # Set the options, send the request and then display the outcome if (!($curl = curl_init())) { print 0; return; } curl_setopt($curl, CURLOPT_URL, $URL); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $postvars); $return = curl_exec($curl); curl_close($curl); $success = urldecode( wasKeyValueGet( "success", $return ) ); if($success == 'False') { # DEBUG: This will be triggered if getting the avatar data fails. #print $uuid." ".urldecode( # wasKeyValueGet( # 'error', # $return # ) #)."\n"; die; } $visual = wasCSVToArray( urldecode( wasKeyValueGet( "data", $return ) ) ); $new = array(); array_push($new, $_POST['id']); switch($visual[32]) { case 0: # DEBUG #print $uuid.' is female '."\n"; array_push($new, 'female'); break; default: # DEBUG #print $uuid.' is male '."\n"; array_push($new, 'male'); break; } array_push($visitors, wasArrayToCSV($new)); atomized_put_contents( $VISITOR_FILE, implode( PHP_EOL, $visitors ) );