Comments (3)
Call this method as many times as you need to upload photos
InstaLite/src/InstaLite/InstaLite.php
Lines 162 to 183 in f047184
Here you need to pass an array of responses received earlier
InstaLite/src/InstaLite/InstaLite.php
Line 188 in f047184
@example
-> addParam( 'upload_id' , [$response1[ 'upload_id' ],$response2[ 'upload_id' ],$response3[ 'upload_id' ]])
from instalite.
Not work.
Send:
Array
(
[0] => 1622750604563
[1] => 1622750606010
[2] => 1622750607029
)
Result:
Uncaught InstaLite\Exception: Error save post: {"message":"Missing info.","status":"fail"}
from instalite.
$upload_id = [];
foreach ($ph as $photo) {
if (!file_exists($photo)) {
throw new Exception("File [$photo] not found");
}
$photo_id = round(microtime(true) * 1000);
$file_temp = DIR . '/' . $this->uuid4();
list($width, $height, $image_type) = getimagesize(realpath($photo));
$srcImage = ImageCreateFromJPEG($photo);
$resImage = ImageCreateTrueColor($width, $height);
ImageCopyResampled($resImage, $srcImage, 0, 0, 0, 0, $width, $height, $width, $height);
ImageJPEG($srcImage, $file_temp, 100);
ImageDestroy($srcImage);
$response = Request::post($this->web . 'rupload_igphoto/fb_uploader_' . $photo_id)
->addHead('content-type', 'image/jpg')
->addHead('x-entity-name', 'fb_uploader_' . $photo_id)
->addHead('offset', 0)
->addHead('user-agent', 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_4_1 like Mac OS X; ru-RU) AppleWebKit/537.36 (KHTML, like Gecko) Version/11.4.1 Mobile/15G77 Safari/537.36 Puffin/5.2.2IP')
->addHead('x-entity-length', filesize($file_temp))
->addHead('x-instagram-rupload-params', '{"media_type":1,"upload_id":"' . $photo_id . '","upload_media_height":' . $height . ',"upload_media_width":' . $width . '}')
->addFile($file_temp)
->json(true);
unlink($file_temp);
if (!isset($response['upload_id'], $response['status']) && $response['status'] != 'ok') {
throw new Exception("Error upload file: " . \json_encode($response));
}
$this->__log('upload file success: ' . \json_encode($response));
$upload_id[] = $response['upload_id'];
}
print_r($upload_id);
$response = Request::post($this->web . 'create/configure/')
->addHead('content-type', 'application/x-www-form-urlencoded')
->addHead('user-agent', 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_4_1 like Mac OS X; ru-RU) AppleWebKit/537.36 (KHTML, like Gecko) Version/11.4.1 Mobile/15G77 Safari/537.36 Puffin/5.2.2IP')
->addParam('upload_id', $upload_id)
->addParam('caption', $message)
->addParam('usertags', '')
->addParam('custom_accessibility_caption', '')
->addParam('retry_timeout', '')
->json(true);
print_r($response);
from instalite.
Related Issues (2)
- Error Authorization HOT 22
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from instalite.