Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(85);
- header("Content-Type: text/html; charset=UTF-8");
- $api_data = array(
- "offer_id" => 1306,
- "api_key" => "b655922bee4a4dc5",
- "name" => trim($_POST['name']),
- "phone" => trim($_POST['phone']),
- "country" =>(trim($_POST['country'])?:"ru"),
- "ip" => $_SERVER['REMOTE_ADDR'],
- "host" => $_SERVER['HTTP_HOST'],
- );
- function curl($url, $post, $headers){
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
- if($post){curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $post);}
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- $rez = curl_exec($ch);
- curl_close($ch);
- return $rez;
- }
- if(trim($_POST['name'])&&trim($_POST['phone'])){
- $api_z = json_decode(curl("http://cpagetti.com/api/order/register", http_build_query($api_data)), true);
- if($_GET['var_dump']=="api"){var_dump($api_data); var_dump($api_z); exit;}
- if($api_z['success']){
- header("Location: success.html"); exit;
- }else{echo "error".(($api_z['message'])?": ".$api_z['message']:"");}
- }else{echo "name and phone required";}
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement