how to mark people in instagram photo using PHP

Asked

Viewed 92 times

3

how do I mark people in photos before uploading to instagram using php

I am currently using this api and in it I can upload the photo with the desired text to instagram, but and I wanted to mark the person in the photo before uploading the photo someone would know how to do this?

function UploadPhoto($image, $caption){
    $this->UploadPhotoApi($image);
    $this->ConfigPhotoApi($caption);
  }


function UploadPhotoApi($file){
    $arrPostData = array();
    $arrPostData['_uuid'] = $this->upload_id;
    $arrPostData['_csrftoken'] = $this->csrftoken;
    $arrPostData['upload_id'] = $this->upload_id;
    $arrPostData['image_compression'] = '{"lib_name":"jt","lib_version":"1.3.0","quality":"100"}';
    $arrPostData['photo'] = curl_file_create(realpath($file));

    $strUrl = $this->api_url."/upload/photo/";

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$strUrl);
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $this->headers);
    curl_setopt($ch, CURLOPT_USERAGENT, $this->user_agent);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $arrPostData);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_COOKIE, $this->cookies);
    $result = curl_exec($ch);
    curl_close ($ch);

    $arrResult = json_decode($result, true);

    if($arrResult['status'] == "ok"){
      return true;
    }else{
      print $result;
      exit;
    }
  }

function ConfigPhotoApi($caption){
    $arrPostData = array();
    $arrPostData['media_folder'] = "Instagram";
    $arrPostData['source_type'] = "4";
    $arrPostData['filter_type'] = "0";

    $arrPostData['_csrftoken'] = $this->csrftoken;
    $arrPostData['_uid'] = $this->uid;
    $arrPostData['_uuid'] = $this->upload_id;
    $arrPostData['upload_id'] = $this->upload_id;
    $arrPostData['caption'] = $caption;

    $arrPostData['device']['manufacturer'] = $this->android_manufacturer;
    $arrPostData['device']['model'] = $this->android_model;
    $arrPostData['device']['android_version'] = $this->android_version;
    $arrPostData['device']['android_release'] = $this->android_release;

    $strUrl = $this->api_url."/media/configure/";

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$strUrl);
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $this->headers);
    curl_setopt($ch, CURLOPT_USERAGENT, $this->user_agent);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $this->generateSignature(json_encode($arrPostData)));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_COOKIE, $this->cookies);
    $result = curl_exec($ch);
    curl_close ($ch);

    $arrResult = json_decode($result, true);

    if($arrResult['status'] == "ok"){
      return true;
    }else{
      print $result;
      exit;
    }
  }

UploadPhoto("nomeImg.jpg", "Legenda da foto");
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.