Codeigniter ile hazırlamış olduğum bir instagram takipçi scripti mevcut, smm market bölümünde perfect panele api verirken her hangi bir sıkıntı yok. Glycon Panel'de "Error, status" hatası ile karşılaşıyorum. Linki almıyor, alsa da siparişi yarı da kesiyor. Bu konu hakkında Instagram API bilgisi yeterli bir yazılımcı arıyorum.

SMM_API_CONTROLLER.php

<?php

class SmmAppController extends CI_controller{

    public $settings;
    public $user;
    public function __construct(){
      parent::__construct();
      logged::is_smm_session();
      $this->db->where('id',1);
      $this->settings = $this->db->get('smm_web_settings')->result()[0];
      $this->db->where('id',$this->session->userdata('id'));
      $this->user = $this->db->get('smm_users')->result()[0];
      if(!isset($this->user->username)){
        redirect(smm_base_url().'logout');
      }
      $this->load->model('Smm_Model');
    }

    public function home(){
        if($this->input->post()){

        }else{
          $data['user'] = $this->user;
          $data['settings'] = $this->settings;
          $this->load->view('smm_layout/static/header',$data);
        }
    }

    public function api(){
      $data['user'] = $this->user;
      $data['settings'] = $this->settings;
      $this->load->view('smm_layout/static/header',$data);
      $this->load->view('smm_layout/api',$data);
    }

    public function services(){
      $list = array();
      $this->db->where('can_view',1);
      $this->db->order_by('id','desc');
      $cats = $this->db->get('smm_categories')->result();
      foreach ($cats as $cat) {
        if($cat->can_view == 1){
          $can_view = 'Aktif';
          $color = 'green';
        }else{
          $can_view = 'Pasif';
          $color = 'red';
        }
        $list[] = array(
          'id'          => $cat->id,
          'category'    => $cat->name,
          'category_id' => $cat->id,
          'can_view'    => $can_view,
          'color'       => $color,
          'services'    => $this->Smm_Model->getServiceForCat($cat->id),
        );
      }

      $data['user'] = $this->user;
      $data['settings'] = $this->settings;
      $data['servicesx'] = $list;
      $this->load->view('smm_layout/static/header',$data);
      $this->load->view('smm_layout/services',$data);
    }

    public function neworder(){
      // Sipariş ver
      header('Content-Type: application/json');
      if($this->input->post()){

        $service = $this->input->post('service');
        $comments = $this->input->post('comments');
        $limit = $this->input->post('limit');
        $link = $this->input->post('link');
        $username = $this->input->post('username');
        if(isset($comments) and $comments != ''){
          $new_limit = explode(PHP_EOL,$comments);
          $limit = count($new_limit);
        }
        $this->db->where('service',$service);
        $get_service = $this->db->get('smm_services')->result();
        if(isset($get_service[0]->service)){

          // Fiyatı hesapla

          if($limit >= $get_service[0]->min){
            if($limit <= $get_service[0]->max){

              $rate = $get_service[0]->rate;
              $charge = ($rate * $limit) / 1000;

              if($this->user->balance >= $charge){
                  // Apiye mi gönderilecek yoksa kendi sunucumuzdan mı atacaz kontol edelim. // sAGO tHE bEST^
                  if($get_service[0]->is_api){ 
                    // Apiye gönderiyoruz
                    $modeller       =  $this->Smm_Model->getApiID($get_service[0]->api_id);
                    $api_url        =  $modeller->api_url;
                    $api_key        = $modeller->api_key;
                    $apiConnection  =  new SmmApi($api_url,$api_key);
                    if($comments){
                      // Yorumlu gönderilecek
                      $order = $apiConnection->order(array('service' => $get_service[0]->is_api, 'link' => $link, 'comments' => $comments));
                      if(!isset($order->error)){
                        if(isset($order->order)){
                          $this->db->insert('smm_orders',array(
                            'service'         => $get_service[0]->service,
                            'link'            => $link,
                            'custom_comments' => $comments,
                            'start_count'     => 0,
                            'status'          => 'Pending',
                            'remains'         => '0',
                            'charge'          => $charge,
                            'currency'        => 'TRY',
                            'quantity'        => $limit,
                            'username'        => $username,
                            'user'            => $this->user->id,
                            'is_api'          => $get_service[0]->is_api,
                            'order_api_id'    => $parseOparseOrder->order,
                                                        'created_time'    => date("d.m.y H:i:s")
                          ));
                          $new_credi = $this->user->balance - $charge;
                          $top_charged = $this->user->harcadi + $charge;
                          $this->db->where('username',$this->user->username);
                          $this->db->update('smm_users',array('balance' => $new_credi, 'harcadi' => $top_charged));
                          echo json_encode(array('message' => 'Siparişiniz alındı!'));
                        }else{
                            // Apide kredimiz bitmiş :(
                          echo json_encode(array('message' => 'Bu servis şu an kullanılamıyor, daha sonra tekrar deneyin'));
                        }
                      }else{
                        echo json_encode(array('message' => $order->error));
                      }

                    }else{

                      if($get_service[0]->type == 'Comment Like'){
                         // Yorum beğeni için parametre yollanıyor apiye
                        $order = $apiConnection->order(array('service' => $get_service[0]->is_api, 'link' => $link, 'username' => $username, 'quantity' => $limit));
                      }else{
                        $order = $apiConnection->order(array('service' => $get_service[0]->is_api, 'link' => $link, 'quantity' => $limit));
                      }



                      if(!isset($order->error)){
                        if(isset($order->order)){
                          $this->db->insert('smm_orders',array(
                            'service'         => $get_service[0]->service,
                            'link'            => $link,
                            'custom_comments' => $comments,
                            'start_count'     => 0,
                            'status'          => 'Pending',
                            'remains'         => '0',
                            'charge'          => $charge,
                            'currency'        => 'TRY',
                            'quantity'        => $limit,
                            'username'        => $username,
                            'user'            => $this->user->id,
                            'is_api'          => $get_service[0]->is_api,
                            'order_api_id'    => $order->order,
                                                        'created_time'    => date("d.m.y H:i:s")
                          ));
                      echo json_encode(array('message' => 'Siparişiniz alındı. Tarih :'. date("d.m.Y H:i:s")));
                              // Bakiye eksilt
                              $new_credi = $this->user->balance - $charge;
                              $top_charged = $this->user->harcadi + $charge;
                              $this->db->where('username',$this->user->username);
                              $this->db->update('smm_users',array('balance' => $new_credi, 'harcadi' => $top_charged));
                        }else{
                            // Apide kredimiz bitmiş :(
                          echo json_encode(array('message' => 'Bu servis şu an kullanılamıyor, daha sonra tekrar deneyin'));
                        }
                      }else{
                        echo json_encode(array('message' => $order->error));
                      }
                    }
                  }else{
                    //Kendi sunucumuzda göndereceğiz

                      if($comments){
                        // Yorumlu
                        $this->db->insert('smm_orders',array(
                          'service'         => $get_service[0]->service,
                          'link'            => $link,
                          'start_count'     => 0,
                          'custom_comments' => $comments,
                          'status'          => 'Pending',
                          'remains'         => '0',
                          'username'        => $username,
                          'charge'          => $charge,
                          'quantity'        => $limit,
                          'currency'        => 'TRY',
                          'user'            => $this->user->id,
                          'is_api'          => $get_service[0]->is_api,
                                                      'created_time'    => date("d.m.y H:i:s")
                        ));
                      }else{
                        // Default ayarlar
                        $this->db->insert('smm_orders',array(
                          'service'         => $get_service[0]->service,
                          'link'            => $link,
                          'username'        => $username,
                          'start_count'     => 0,
                          'status'          => 'Pending',
                          'remains'         => '0',
                          'charge'          => $charge,
                          'currency'        => 'TRY',
                          'quantity'        => $limit,
                          'user'            => $this->user->id,
                          'is_api'          => $get_service[0]->is_api,
                          'created_time'    => date("d.m.y H:i:s")
                        ));

                      }
                      $new_credi = $this->user->balance - $charge;
                      $top_charged = $this->user->harcadi + $charge;
                      $this->db->where('username',$this->user->username);
                      $this->db->update('smm_users',array('balance' => $new_credi, 'harcadi' => $top_charged));
                      echo json_encode(array('message' => 'Siparişiniz alındı. Tarih :'. date("d.m.Y H:i:s")));
                  }

              }else{
                echo json_encode(array('message' => 'Bu işlemi gerçekleştirmek için bakiyeniz yetersiz.'));
              }


            }else{
              echo json_encode(array('message' => 'Limit en fazla '.$get_service[0]->max.' olabilir'));
            }
          }else{
            echo json_encode(array('message' => 'Limit en az '.$get_service[0]->min.' olabilir.'));
          }

        }else{
          echo json_encode(array('message' => 'Servis bulunamadı, kaldırılmış olabilir. lütfen sayfayı yenileyip tekrar deneyiniz.'));
        }
      }else{
        echo json_encode(array('message' => 'Invalid api key'));
      }
    }

    public function myOrders(){
      $this->db->order_by('id','desc');
      $this->db->where('user',$this->user->id);
      $get = $this->db->get('smm_orders')->result();
      $data['user'] = $this->user;
      $data['settings'] = $this->settings;
      $data['orders'] = $get;
      $this->load->view('smm_layout/static/header',$data);
      $this->load->view('smm_layout/orders',$data);
    }

    public function getService(){
      if($this->input->post()){
        $service = $this->input->post('service');
        if($service){
          $this->db->where('service',$service);
          $is = $this->db->get('smm_services')->result();
          if(isset($is[0])){
            echo json_encode($is[0]);
          }
        }else{
          echo json_encode(array('status' => 'fail'));
        }
      }else{
        echo json_encode(array('status' => 'fail'));
      }
    }

}

?>