curl_setopt($curl, CURLOPT_HTTPHEADER, array('Authorization: Client-ID ' . $client_id)); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $pvars); $out = curl_exec($curl); curl_close($curl); $pms = json_decode($out, true); $url = $pms['data']['link']; $profile->photoLink = $url; /* if ($url != "") { echo "<h2>Uploaded Without Any Problem</h2>"; echo "<img src='$url'/>"; echo $url; } else { echo "<h2>There's a Problem</h2>"; echo $pms['data']['error']['message']; } */ } } $profile->token = $_SESSION['token']; $insert = insertProfile($profile); if (empty($insert)) { header("Location: http://" . redirectLink() . "/SafeFront/index.php?action=listProfiles&method=Profile inserted sucessfully"); } else { echo $insert; } //TODO chamar web services com isto tudo ?> </body> </html>
<?php include "pdo.php"; $firstName = $_POST['firstName']; $lastName = $_POST['lastName']; $username = $_POST['username']; $password = $_POST['password']; $email = $_POST['email']; $id = insertAccount($username, $password); if ($id != false) { insertProfile($id, $firstName, $lastName, $email); echo true; } else { echo false; }