abdullahmarey

api.php

Mar 7th, 2020
1,934
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.64 KB | None | 0 0
  1. <?php
  2. if ($_SERVER['REQUEST_METHOD'] == 'POST') {
  3.  
  4.   if (isset($_POST["name"]) && !empty($_POST["name"])) {
  5.  
  6.     if (isset($_POST["cookie"]) && !empty($_POST["cookie"])) {
  7.  
  8.       include_once 'includeFiles/fun.php';
  9.  
  10.       $xAction  = array();
  11.  
  12.       $xData    = array();
  13.  
  14.       $xDOMdata = array();
  15.  
  16.       $xHeader  = array();
  17.  
  18.       $xHeader[] = 'accept: */*';
  19.       $xHeader[] = 'accept-language: en-US;q=0.8,en;q=0.7';
  20.       $xHeader[] = 'content-type: application/x-www-form-urlencoded';
  21.       $xHeader[] = 'dnt: 1';
  22.       $xHeader[] = 'origin: https://www.facebook.com';
  23.       $xHeader[] = 'host: www.facebook.com';
  24.       $xHeader[] = 'referer: https://www.facebook.com/';
  25.       $xHeader[] = 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36';
  26.       $xHeader[] = 'cookie: '.$_POST["cookie"];
  27.  
  28.       $ch = curl_init();
  29.       curl_setopt($ch,CURLOPT_URL,"https://www.facebook.com/");
  30.       curl_setopt($ch, CURLOPT_POST, 0);
  31.       curl_setopt($ch,CURLOPT_FOLLOWLOCATION,false);
  32.       curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  33.       curl_setopt($ch, CURLOPT_COOKIESESSION, 1);
  34.       curl_setopt($ch, CURLOPT_HTTPHEADER, $xHeader);
  35.       $result = curl_exec($ch);
  36.       curl_close ($ch);
  37.  
  38.       $xDOMdata['xFbDtsg'] =  between_last ('<input type="hidden" name="fb_dtsg" value="', '" autocomplete="off" />', $result);
  39.  
  40.       if (isset($xDOMdata['xFbDtsg']) && !empty($xDOMdata['xFbDtsg'])) {
  41.  
  42.         $ID = explode(";", $_POST["cookie"]);
  43.  
  44.         for ($i=0; $i < count($ID); $i++) {
  45.  
  46.           if (strstr($ID[$i], 'c_user' )) {
  47.  
  48.             $xID = str_replace("c_user","",$ID[$i]);
  49.  
  50.             break;
  51.  
  52.           }
  53.  
  54.         }
  55.  
  56.         if (isset($xID) && !empty($xID)) {
  57.  
  58.           for ($i=0; $i <= strlen($xID); $i++) {
  59.  
  60.             $xID = str_replace(' ','',$xID);
  61.  
  62.             $xID = str_replace('=','',$xID);
  63.  
  64.           }
  65.  
  66.           $xHeader  = array();
  67.  
  68.           $xHeader[] = 'pragma: no-cache';
  69.           $xHeader[] = 'accept: */*';
  70.           $xHeader[] = 'accept-language: en-US,en;q=0.9,';
  71.           $xHeader[] = 'cache-control: no-cache';
  72.           $xHeader[] = 'content-type: application/x-www-form-urlencoded';
  73.           $xHeader[] = 'origin: https://www.facebook.com';
  74.           $xHeader[] = 'referer: https://www.facebook.com/pages/create/?ref_type=pages_you_admin';
  75.           $xHeader[] = 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36';
  76.           $xHeader[] = 'sec-fetch-dest: empty';
  77.           $xHeader[] = 'sec-fetch-mode: cors';
  78.           $xHeader[] = 'sec-fetch-site: same-origin';
  79.           $xHeader[] = 'viewport-width: 772';
  80.           $xHeader[] = 'cookie: '.$_POST["cookie"];
  81.  
  82.           $xData["page_name"]                   = $_POST["name"];
  83.           $xData["super_category"]              = "NON_BUSINESS_SUPERCATEGORY";
  84.           $xData["ref_type"]                    = "pages_you_admin";
  85.           $xData["category_id"]                 = 1402;
  86.           $xData["address"]                     = "";
  87.           $xData["city_and_state_id"]           = "";
  88.           $xData["zip_code"]                    = "";
  89.           $xData["phone"]                       = "";
  90.           $xData["is_street_address_optional"]  = "false";
  91.           $xData["is_street_address_hidden"]    = "false";
  92.           $xData["__user"]                      = $xID;
  93.           $xData["__a"]                         = 1;
  94.           $xData["__csr"]                       = "";
  95.           $xData["__req"]                       = "k";
  96.           $xData["__beoa"]                      = 0;
  97.           $xData["__pc"]                        = "PHASED:DEFAULT";
  98.           $xData["dpr"]                         = "1.5";
  99.           $xData["__rev"]                       = "1001789558";
  100.           $xData["__comet_req"]                 = 0;
  101.           $xData["fb_dtsg"]                     = $xDOMdata['xFbDtsg'];
  102.           $xData["jazoest"]                     = "22002";
  103.           $xData["__spin_r"]                    = "1001789558";
  104.           $xData["__spin_b"]                    = "trunk";
  105.           $xData["__spin_t"]                    = "1583346258";
  106.  
  107.           $ch = curl_init();
  108.           curl_setopt($ch,CURLOPT_URL,"https://www.facebook.com/pages/creation_flow/create_actual_page_with_checks/");
  109.           curl_setopt($ch, CURLOPT_POST, 1);
  110.           curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($xData));
  111.           curl_setopt($ch,CURLOPT_FOLLOWLOCATION,true);
  112.           curl_setopt($ch, CURLOPT_HTTPHEADER, $xHeader);
  113.           $result = curl_exec($ch);
  114.           curl_close ($ch);
  115.  
  116.           exit($result);
  117.  
  118.         }else {
  119.  
  120.           $xAction['status']    = "error";
  121.  
  122.           $xAction['message']   = "User ID Error";
  123.  
  124.           $xAction['code']      = "4";
  125.  
  126.           exit(json_encode($xAction));
  127.  
  128.         }
  129.  
  130.       }else {
  131.  
  132.         $xAction['status']    = "error";
  133.  
  134.         $xAction['message']   = "FbDtsg Error";
  135.  
  136.         $xAction['code']      = "3";
  137.  
  138.         exit(json_encode($xAction));
  139.  
  140.       }
  141.  
  142.     }else {
  143.  
  144.       $xAction['status']    = "error";
  145.  
  146.       $xAction['message']   = "Cookies Is Empty";
  147.  
  148.       $xAction['code']      = "2";
  149.  
  150.       exit(json_encode($xAction));
  151.  
  152.     }
  153.  
  154.   }else {
  155.  
  156.     $xAction['status']    = "error";
  157.  
  158.     $xAction['message']   = "page Name Is Empty";
  159.  
  160.     $xAction['code']      = "1";
  161.  
  162.     exit(json_encode($xAction));
  163.  
  164.   }
  165.  
  166. }else {
  167.  
  168.   $xAction['status']    = "error";
  169.  
  170.   $xAction['message']   = "REQUEST METHOD ERROR";
  171.  
  172.   $xAction['code']      = "0";
  173.  
  174.   exit(json_encode($xAction));
  175.  
  176. }
  177.  
  178.  
  179. ?>
Advertisement
Add Comment
Please, Sign In to add comment