A lại bị req nhiều quá vào 1 file PHP trong 1s là cả VPS tạch luôn PHP chỉ còn chạy mỗi HTML vs file ảnh :D tầm 300rq/s vào file PHP (100 line có curl)
- Khi dùng /new-key sẽ tạo 1 key + upload file đầu tiên
- Sử dụng lại key sinh ra ở new-key để upload thêm các ảnh khác
- Chèn key vào khi /threads
Thử thư viện này html to bdcode https://github.com/vamsiikrishna/html-to-bbcode
Không cố định là sao nhỉ? Nếu user upload lên thì sẽ có file upload, nếu là file url sẽ là file url, nếu file trong thư mục sẽ là file.
Còn code upload qua api như sau:
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'xxxxxxxxxxxxxx/api/attachments/new-key'...
Thay vì chèn attachment mình update file ảnh vào 1 thư mục ở host rồi chèn vào bài ở dạng Bdcode cho tiện
// add images to body
if ($images) {
$new_images = bc_images($images,$title);
if ($new_images && sizeof($new_images) >0){
$message .= "
";
foreach...