Curl 7 86 0
Author: f | 2025-04-24
Blitz Chess 1 point 8 matches. Checkers 0 points 7 matches Backgammon 0 points 7 matches Curling 0 points 7 matches TOB-CURL-11 (Unused memory blocks are not freed, resulting in memory leaks) cURL allocates blocks of memory that are not freed when they are no longer needed, leading to memory leaks. This issue is fixed in cURL 7.87.0. To reproduce the bug, use the following commands: $ curl 0 -Z 0 -Tz 0 $ curl 00 -cu 00 $ curl -proto =0 -proto =0 Dockerfile
Mediainfo 0 7 86 Download Free - coolaup
"size": 4, "shape": [ 48, 128 ], "total_size": 6144}*/// for convenience, these are extracted from metadata:data.dtype// "data.shape// (2) [48, 128]// data are loaded into a matching TypedArray in javascript if one exists, otherwise raw bytes are returned (there is no Float16Array, for instance). In this case the matching type is Int32Arraydata.value/*Int32Array(6144) [0, 0, 0, 2, 2, 2, 3, 1, 1, 7, 3, 5, 7, 8, 9, 21, 43, 38, 47, 8, 8, 7, 3, 6, 1, 7, 3, 7, 47, 94, 91, 99, 76, 81, 86, 112, 98, 103, 85, 100, 83, 122, 111, 123, 136, 129, 134, 164, 130, 164, 176, 191, 200, 211, 237, 260, 304, 198, 32, 9, 5, 2, 6, 5, 8, 6, 25, 219, 341, 275, 69, 11, 4, 5, 5, 45, 151, 154, 141, 146, 108, 107, 105, 113, 99, 101, 96, 84, 86, 77, 78, 107, 73, 80, 105, 65, 75, 79, 62, 31, …]*/// take a slice from 0:10 on axis 0, keeping all of axis 1:// (slicing is done through libhdf5 instead of in the javascript library - should be very efficient)data.slice([[0,10],[]])/*Int32Array(1280) [0, 0, 0, 2, 2, 2, 3, 1, 1, 7, 3, 5, 7, 8, 9, 21, 43, 38, 47, 8, 8, 7, 3, 6, 1, 7, 3, 7, 47, 94, 91, 99, 76, 81, 86, 112, 98, 103, 85, 100, 83, 122, 111, 123, 136, 129, 134, 164, 130, 164, 176, 191, 200, 211, 237, 260, 304, 198, 32, 9, 5, 2, 6, 5, 8, 6, 25, 219, 341, 275, 69, 11, 4, 5, 5, 45, 151, 154, 141, 146, 108, 107, 105, 113, 99, 101, 96, 84, 86, 77, 78, 107, 73, 80, 105, 65, 75, 79, 62, 31, …]*/// Convert to nested Array, with JSON-compatible elements:data.to_array()/*[ [ 0, 0, 0, 2, 2, 2, 3, 1, 1, 7, 3, 5, 7, 8, 9, 21, 43, 38, 47, 8, 8, 7, 3, 6, 1, 7, 3, 7, 47, 94, 91, 99, 76, 81, 86, 112, 98, 103, 85, 100, 83, 122, 111, 123, 136, 129, 134, 164, 130, 164, 176, 191, 200, 211, 237, 260, 304, 198, 32, 9, 5, 2, 6, 5, 8, 6, 25, 219, 341, 275, 69, 11, 4, 5, 5, 45, 151, 154, 141, 146, 108, 107, 105, 113, 99, 101, 96, 84, 86, 77, 78, 107, 73, 80, 105, 65, 75, 79, 62, 31, ... 28 more items ], [ 0, 0, 2, 2, Blitz Chess 1 point 8 matches. Checkers 0 points 7 matches Backgammon 0 points 7 matches Curling 0 points 7 matches TOB-CURL-11 (Unused memory blocks are not freed, resulting in memory leaks) cURL allocates blocks of memory that are not freed when they are no longer needed, leading to memory leaks. This issue is fixed in cURL 7.87.0. To reproduce the bug, use the following commands: $ curl 0 -Z 0 -Tz 0 $ curl 00 -cu 00 $ curl -proto =0 -proto =0 Dockerfile Collaboration Employee Management Leave and Absence Management Mobile Capabilities Platform Capabilities Shiftbase Humanity HotSchedules Sling Lightning Bolt Collaboration Employee Management Leave And AbsenceManagement Mobile Capabilities Platform Capabilities Reporting and Analytics Schedule Management Security AndCompliance Shift Management Time And AttendanceManagement 52 62 91 83 63 81 84 67 79 74 52 100 91 100 75 83 96 83 79 85 91 87 78 98 75 95 86 56 86 83 0 25 50 75 100 50% 50% 50% 50% 0% 100% 88% 12% 0% 100% 58% 42% 100% 0% 0% 100% 83% 17% 0% 100% 88% 12% 88% 12% 0% 100% 75% 25% 0% 100% 80% 20% 100% 0% 0% 100% 93% 7% 0% 100% 67% 33% 78% 22% 0% 100% 78% 22% 0% 100% 83% 17% 83% 17% 0% 100% 100% 0% 0% 100% 80% 20% 95% 5% 0% 100% 80% 20% 0% 100% 67% 33% 78% 22% 0% 100% 56% 44% 0% 100% 79% 21% 79% 21% 0% 100% 84% 16% 0% 100% 74% 26% 84% 16% 0% 100% 84% 16% 0% 100% 80% 20% 70% 30% 0% 100% 60% 40% 0% 100% 421 reviews 1401 reviews 1149 reviews 234 reviews 3 reviews 90% of users recommend this product Shiftbase has a 'excellent' User Satisfaction Rating of 90% when considering 421 user reviews from 2 recognized software review sites. 86% of users recommend this product Humanity has a 'great' User Satisfaction Rating of 86% when considering 1401 user reviews from 5 recognized software review sites. 86% of users recommend this product HotSchedules has a 'great' User Satisfaction Rating of 86% when considering 1149 user reviews from 5 recognized software review sites. 91% of users recommend this product Sling has a 'excellent' User Satisfaction Rating of 91% when considering 234 user reviews from 2 recognized software review sites. 60% ofComments
"size": 4, "shape": [ 48, 128 ], "total_size": 6144}*/// for convenience, these are extracted from metadata:data.dtype// "data.shape// (2) [48, 128]// data are loaded into a matching TypedArray in javascript if one exists, otherwise raw bytes are returned (there is no Float16Array, for instance). In this case the matching type is Int32Arraydata.value/*Int32Array(6144) [0, 0, 0, 2, 2, 2, 3, 1, 1, 7, 3, 5, 7, 8, 9, 21, 43, 38, 47, 8, 8, 7, 3, 6, 1, 7, 3, 7, 47, 94, 91, 99, 76, 81, 86, 112, 98, 103, 85, 100, 83, 122, 111, 123, 136, 129, 134, 164, 130, 164, 176, 191, 200, 211, 237, 260, 304, 198, 32, 9, 5, 2, 6, 5, 8, 6, 25, 219, 341, 275, 69, 11, 4, 5, 5, 45, 151, 154, 141, 146, 108, 107, 105, 113, 99, 101, 96, 84, 86, 77, 78, 107, 73, 80, 105, 65, 75, 79, 62, 31, …]*/// take a slice from 0:10 on axis 0, keeping all of axis 1:// (slicing is done through libhdf5 instead of in the javascript library - should be very efficient)data.slice([[0,10],[]])/*Int32Array(1280) [0, 0, 0, 2, 2, 2, 3, 1, 1, 7, 3, 5, 7, 8, 9, 21, 43, 38, 47, 8, 8, 7, 3, 6, 1, 7, 3, 7, 47, 94, 91, 99, 76, 81, 86, 112, 98, 103, 85, 100, 83, 122, 111, 123, 136, 129, 134, 164, 130, 164, 176, 191, 200, 211, 237, 260, 304, 198, 32, 9, 5, 2, 6, 5, 8, 6, 25, 219, 341, 275, 69, 11, 4, 5, 5, 45, 151, 154, 141, 146, 108, 107, 105, 113, 99, 101, 96, 84, 86, 77, 78, 107, 73, 80, 105, 65, 75, 79, 62, 31, …]*/// Convert to nested Array, with JSON-compatible elements:data.to_array()/*[ [ 0, 0, 0, 2, 2, 2, 3, 1, 1, 7, 3, 5, 7, 8, 9, 21, 43, 38, 47, 8, 8, 7, 3, 6, 1, 7, 3, 7, 47, 94, 91, 99, 76, 81, 86, 112, 98, 103, 85, 100, 83, 122, 111, 123, 136, 129, 134, 164, 130, 164, 176, 191, 200, 211, 237, 260, 304, 198, 32, 9, 5, 2, 6, 5, 8, 6, 25, 219, 341, 275, 69, 11, 4, 5, 5, 45, 151, 154, 141, 146, 108, 107, 105, 113, 99, 101, 96, 84, 86, 77, 78, 107, 73, 80, 105, 65, 75, 79, 62, 31, ... 28 more items ], [ 0, 0, 2, 2,
2025-04-19Collaboration Employee Management Leave and Absence Management Mobile Capabilities Platform Capabilities Shiftbase Humanity HotSchedules Sling Lightning Bolt Collaboration Employee Management Leave And AbsenceManagement Mobile Capabilities Platform Capabilities Reporting and Analytics Schedule Management Security AndCompliance Shift Management Time And AttendanceManagement 52 62 91 83 63 81 84 67 79 74 52 100 91 100 75 83 96 83 79 85 91 87 78 98 75 95 86 56 86 83 0 25 50 75 100 50% 50% 50% 50% 0% 100% 88% 12% 0% 100% 58% 42% 100% 0% 0% 100% 83% 17% 0% 100% 88% 12% 88% 12% 0% 100% 75% 25% 0% 100% 80% 20% 100% 0% 0% 100% 93% 7% 0% 100% 67% 33% 78% 22% 0% 100% 78% 22% 0% 100% 83% 17% 83% 17% 0% 100% 100% 0% 0% 100% 80% 20% 95% 5% 0% 100% 80% 20% 0% 100% 67% 33% 78% 22% 0% 100% 56% 44% 0% 100% 79% 21% 79% 21% 0% 100% 84% 16% 0% 100% 74% 26% 84% 16% 0% 100% 84% 16% 0% 100% 80% 20% 70% 30% 0% 100% 60% 40% 0% 100% 421 reviews 1401 reviews 1149 reviews 234 reviews 3 reviews 90% of users recommend this product Shiftbase has a 'excellent' User Satisfaction Rating of 90% when considering 421 user reviews from 2 recognized software review sites. 86% of users recommend this product Humanity has a 'great' User Satisfaction Rating of 86% when considering 1401 user reviews from 5 recognized software review sites. 86% of users recommend this product HotSchedules has a 'great' User Satisfaction Rating of 86% when considering 1149 user reviews from 5 recognized software review sites. 91% of users recommend this product Sling has a 'excellent' User Satisfaction Rating of 91% when considering 234 user reviews from 2 recognized software review sites. 60% of
2025-04-11(20):} [52 bytes data]SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384ALPN: server accepted http/1.1Server certificate:subject: CN=ubuntustart date: Feb 10 15:24:51 2023 GMTexpire date: Feb 7 15:24:51 2033 GMTissuer: CN=ubuntuSSL certificate verify result: self-signed certificate (18), continuing anyway.using HTTP/1.1} [5 bytes data]GET / HTTP/1.1Host: 127.0.0.1User-Agent: curl/7.88.1-DEVAccept: /{ [5 bytes data]TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):{ [230 bytes data]TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):{ [230 bytes data]old SSL session ID is stale, removing{ [5 bytes data]{ [10701 bytes data]################################################################################################################################ 100.0%* Connection #0 to host 127.0.0.1 left intactExcpeted is to not fall back to http1.1 and expected result should look something like this belowroot@ubuntu:~# curl -# -v -k --http3 -o index.html 127.0.0.1:443...Skipped certificate verificationConnected to 127.0.0.1 (127.0.0.1) port 443 (#0)using HTTP/3h2h3 [:method: GET]h2h3 [:path: /]h2h3 [:scheme: https]h2h3 [:authority: 127.0.0.1]h2h3 [user-agent: curl/7.88.1-DEV]h2h3 [accept: /]Using HTTP/3 Stream ID: 0 (easy handle 0x556d310dff30)GET / HTTP/3Host: 127.0.0.1user-agent: curl/7.88.1-DEVaccept: /{ [3483 bytes data]################################################################################################################################ 100.0%* Connection #0 to host 127.0.0.1 left intactroot@ubuntu:~# curl -Vcurl 7.88.1-DEV (x86_64-pc-linux-gnu) libcurl/7.88.1-DEV OpenSSL/3.0.0 zlib/1.2.11 brotli/1.0.9 ngtcp2/0.14.0-DEV nghttp3/0.9.0-DEVRelease-Date: [unreleased]Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftpFeatures: alt-svc AsynchDNS brotli HSTS HTTP3 HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL threadsafe TLS-SRP UnixSocketsPRETTY_NAME="Ubuntu 22.04.1 LTS"NAME="Ubuntu"VERSION_ID="22.04"VERSION="22.04.1 LTS (Jammy Jellyfish)"root@ubuntu:# nginx -Vnginx version: nginx/1.23.4 (nginx-quic)built by gcc 11.3.0 (Ubuntu 11.3.0-1ubuntu122.04)built with OpenSSL 1.1.1 (compatible; BoringSSL) (running with BoringSSL)TLS SNI support enabledconfigure arguments: --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-compat --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module
2025-03-30--------------------------------------freshclam daemon 1.0.6 (OS: Linux, ARCH: x86_64, CPU: x86_64)ClamAV update process started at Wed Nov 13 22:58:39 2024daily database available for update (local version: 26951, remote version: 27457)WARNING: downloadFile: file not found: downloadPatch: Can't download daily-26952.cdiff from downloadFile: file not found: downloadPatch: Can't download daily-26952.cdiff from downloadFile: file not found: downloadPatch: Can't download daily-26952.cdiff from Incremental update failed, trying to download daily.cvdTesting database: '/opt/zimbra/data/clamav/db/tmp.c6c4bde2c0/clamav-71471ba8e88d7cef2c3289b824b9a580.tmp-daily.cvd' ...Database test passed.daily.cvd updated (version: 27457, sigs: 2067892, f-level: 90, builder: raynman)main.cvd database is up-to-date (version: 62, sigs: 6647427, f-level: 90, builder: sigmgr)bytecode database available for update (local version: 334, remote version: 335)Testing database: '/opt/zimbra/data/clamav/db/tmp.c6c4bde2c0/clamav-186b71904808f37c645f8065a09869ff.tmp-bytecode.cld' ...Database test passed.bytecode.cld updated (version: 335, sigs: 86, f-level: 90, builder: raynman)Clamd successfully notified about the update. GET /daily-26952.cdiff HTTP/2> Host: database.clamav.net> User-Agent: curl/7.61.1> Accept: */*>* TLSv1.3 (IN), TLS handshake, [no content] (0):* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):* TLSv1.3 (IN), TLS app data, [no content] (0):* Connection state changed (MAX_CONCURRENT_STREAMS == 100)!* TLSv1.3 (OUT), TLS app data, [no content] (0):* TLSv1.3 (IN), TLS app data, [no content] (0): Attention Required! | Cloudflarebody{margin:0;padding:0} if (!navigator.cookieEnabled) { window.addEventListener('DOMContentLoaded', function () { var cookieEl = document.getElementById('cookie-alert'); cookieEl.style.display = 'block'; }) } Please enable cookies.* TLSv1.3 (IN), TLS app data, [no content] (0): Sorry, you have been blocked You are unable to access clamav.net Why have I been blocked? This website is using a security service to protect itself from online attacks. The action you just performed triggered the security solution. There are several actions that could trigger this block including submitting a certain word or phrase, a SQL command or malformed data. What can I do to resolve this?* TLSv1.3 (IN), TLS app data, [no content] (0): You can email the site owner to let them know you were blocked. Please include what you were doing when this page came up and the Cloudflare Ray ID found at the bottom of this page. Cloudflare Ray ID: 8e22827bda1f94b7 • Your IP: Click to reveal 88.97.91.208 • Performance & security by Cloudflare * TLSv1.3 (IN), TLS app data, [no content] (0): (function(){function d(){var b=a.getElementById("cf-footer-item-ip"),c=a.getElementById("cf-footer-ip-reveal");b&&"classList"in b&&(b.classList.remove("hidden"),c.addEventListener("click",function(){c.classList.add("hidden");a.getElementById("cf-footer-ip").classList.remove("hidden")}))}var a=document;document.addEventListener&&a.addEventListener("DOMContentLoaded",d)})(); window._cf_translation = {};* TLSv1.3 (IN), TLS app data, [no content] (0):* Connection #0 to host database.clamav.net left intact">curl -v Trying 104.16.219.84...* TCP_NODELAY set* Connected to database.clamav.net (104.16.219.84) port 443 (#0)* ALPN, offering h2* ALPN, offering http/1.1* successfully set certificate verify locations:* CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none* TLSv1.3 (OUT), TLS handshake, Client hello (1):* TLSv1.3 (IN), TLS handshake, Server hello (2):* TLSv1.3 (IN), TLS handshake, [no content] (0):* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):* TLSv1.3 (IN), TLS handshake, Certificate (11):* TLSv1.3 (IN), TLS handshake, CERT verify (15):* TLSv1.3 (IN), TLS handshake, Finished (20):* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):* TLSv1.3 (OUT), TLS handshake, [no content] (0):* TLSv1.3 (OUT), TLS handshake, Finished (20):* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384* ALPN, server accepted to use h2* Server certificate:* subject: CN=database.clamav.net* start date: Oct 8 10:45:45 2024 GMT* expire date: Jan 6 10:45:44 2025 GMT* subjectAltName: host "database.clamav.net" matched cert's "database.clamav.net"* issuer:
2025-04-15NoticeThe URL of the result image is valid for 1 hour. Please download the image file promptly.Supported ImagesFormatResolutionFile sizejpg, jpeg, bmp, png, webp, tiff, tif, bitmap, raw, rgb, jfif, lzwUp to 4096 x 4096Up to 15MBGet StartedSee differences between the 3 API call types #Create a task.curl -k ' \-H 'X-API-KEY: YOUR_API_KEY' \-F 'sync=0' \-F 'image_url=YOU_IMG_URL'#Get the cutout result#Polling requests using the following methods 1. The polling interval is set to 1 second, 2. The polling time does not exceed 30 secondscurl -k ' \-H 'X-API-KEY: YOUR_API_KEY' \php//Create a task$curl = curl_init();curl_setopt($curl, CURLOPT_URL, ' CURLOPT_HTTPHEADER, array( "X-API-KEY: YOUR_API_KEY", "Content-Type: multipart/form-data",));curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);curl_setopt($curl, CURLOPT_POST, true);curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);curl_setopt($curl, CURLOPT_POSTFIELDS, array('sync' => 0, 'image_url' => "YOUR_IMG_URL"));$response = curl_exec($curl);$result = curl_errno($curl) ? curl_error($curl) : $response;curl_close($curl);$result = json_decode($result, true);if ( !isset($result["status"]) || $result["status"] != 200 ) { // request failed, log the details var_dump($result); die("post request failed");}// var_dump($result);$task_id = $result["data"]["task_id"];//get the task result// 1、"The polling interval is set to 1 second."//2 "The polling time is around 30 seconds."for ($i = 1; $i 30; $i++) { if ($i != 1) { sleep(1); } $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, " curl_setopt($curl, CURLOPT_HTTPHEADER, array( "X-API-KEY: YOUR_API_KEY", )); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); $response = curl_exec($curl); $result = curl_errno($curl) ? curl_error($curl) : $response; curl_close($curl); var_dump($result); $result = json_decode($result, true); if ( !isset($result["status"]) || $result["status"] != 200 ) { // Task exception, logging the error. //You can choose to continue the loop with 'continue' or break the loop with 'break' var_dump($result); continue; } if ( $result["data"]["state"] == 1 ) { // task success var_dump($result["data"]["image"]); break; } else if ( $result["data"]["state"] 0) { // request failed, log the details var_dump($result); break; } else { // Task processing if ($i == 30) { //Task processing, abnormal situation, seeking assistance from customer service of picwish } }}public static void main(String[] args) throws Exception { String taskId = createTask(); String result = pollingTaskResult(taskId, 0); System.out.println(result);}private static String createTask() throws Exception { OkHttpClient okHttpClient = new OkHttpClient.Builder().build(); RequestBody requestBody = new MultipartBody.Builder() .setType(MultipartBody.FORM) .addFormDataPart("image_url", "IMAGE_HTTP_URL") .addFormDataPart("sync", "0") .build(); Request request = new Request.Builder() .url(" .addHeader("X-API-KEY", "YOUR_API_KEY") .post(requestBody) .build(); Response response = okHttpClient.newCall(request).execute(); JSONObject jsonObject = new JSONObject(response.body().string()); int status = jsonObject.optInt("status"); if (status != 200) { throw new Exception(jsonObject.optString("message")); } return jsonObject.getJSONObject("data").optString("task_id");}private static String pollingTaskResult(String taskId, int pollingTime) throws Exception { if (pollingTime >= 30) throw new IllegalStateException("Polling result timeout."); OkHttpClient okHttpClient = new OkHttpClient.Builder().build(); Request taskRequest = new Request.Builder() .url(" + taskId) .addHeader("X-API-KEY", "YOUR_API_KEY") .get() .build(); Response taskResponse = okHttpClient.newCall(taskRequest).execute(); JSONObject jsonObject = new JSONObject(taskResponse.body().string()); int state = jsonObject.getJSONObject("data").optInt("state"); if (state 0) { // Error. throw new Exception(jsonObject.optString("message")); } if (state == 1) { // Success and get result. return jsonObject.getJSONObject("data").toString(); } Thread.sleep(1000); return pollingTaskResult(taskId, ++pollingTime);}const request = require("request");const fs = require("fs");const path = require('path')const API_KEY = "YOUR_API_KEY";(async function main() { const taskId = await createTask() const result = await polling(() => getTaskResult(taskId)) console.log(`result: ${JSON.stringify(result, null, 2)}`)})()const polling = async (fn, delay = 1 * 1000, timeout = 30 * 1000) => { if (!fn) { throw new Error('fn is required') } try
2025-03-29`json:"task_id"` Image string `json:"image"` ReturnType uint `json:"return_type"` Type string `json:"type"` Progress uint `json:"progress"` //不确定有没有,需要查询看看 State int `json:"state"` TimeElapsed float64 `json:"time_elapsed"` } `json:"data"`}func main() { // JSON data is passed and received here, and code modification is required. jsonData := `{ "status": 200, "message": "Success", "data": { "task_id": "123456", "image": "image_data", } }` // Parse JSON data into VisualScaleResponse struct var response VisualScaleResponse err := json.Unmarshal([]byte(jsonData), &response) if err != nil { fmt.Println("Error parsing JSON:", err) return } // Query the relevant content in the database based on the taskID and associate it with the image below. fmt.Println("Image:", response.Data.TaskId) // Print the 'image' field fmt.Println("Image:", response.Data.Image)} #Create a taskcurl -k ' \-H 'X-API-KEY: YOUR_API_KEY' \-F 'sync=0' \-F 'image_file=@/path/to/image.jpg'#Get the cutout result#Polling requests using the following methods 1. The polling interval is set to 1 second, 2. The polling time does not exceed 30 secondscurl -k ' \-H 'X-API-KEY: YOUR_API_KEY' \php//Create a task$curl = curl_init();curl_setopt($curl, CURLOPT_URL, ' CURLOPT_HTTPHEADER, array( "X-API-KEY: YOUR_API_KEY", "Content-Type: multipart/form-data",));curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);curl_setopt($curl, CURLOPT_POST, true);curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);curl_setopt($curl, CURLOPT_POSTFIELDS, array('sync' => 0, 'image_file' => new CURLFILE("/path/to/image.jpg")));$response = curl_exec($curl);$result = curl_errno($curl) ? curl_error($curl) : $response;curl_close($curl);$result = json_decode($result, true);if ( !isset($result["status"]) || $result["status"] != 200 ) { // request failed, log the details var_dump($result); die("post request failed");}// var_dump($result);$task_id = $result["data"]["task_id"];//get the task result// 1、"The polling interval is set to 1 second."//2 "The polling time is around 30 seconds."for ($i = 1; $i 30; $i++) { if ($i != 1) { sleep(1); } $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, " curl_setopt($curl, CURLOPT_HTTPHEADER, array( "X-API-KEY: YOUR_API_KEY", )); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); $response = curl_exec($curl); $result = curl_errno($curl) ? curl_error($curl) : $response; curl_close($curl); var_dump($result); $result = json_decode($result, true); if ( !isset($result["status"]) || $result["status"] != 200 ) { // Task exception, logging the error. //You can choose to continue the loop with 'continue' or break the loop with 'break' var_dump($result); continue; } if ( $result["data"]["state"] == 1 ) { // task success var_dump($result["data"]["image"]); break; } else if ( $result["data"]["state"] 0) { // request failed, log the details var_dump($result); break; } else { // Task processing if ($i == 30) { //Task processing, abnormal situation, seeking assistance from customer service of picwish } }}public static void main(String[] args) throws Exception { String taskId = createTask(); String result = pollingTaskResult(taskId, 0); System.out.println(result);}private static String createTask() throws Exception { OkHttpClient okHttpClient = new OkHttpClient.Builder().build(); RequestBody requestBody = new MultipartBody.Builder() .setType(MultipartBody.FORM) .addFormDataPart("image_file", JPG_FILE_NAME, RequestBody.create({JPG_FILE}, MediaType.parse("image/jpeg"))) .addFormDataPart("sync", "0") .build(); Request request = new Request.Builder() .url(" .addHeader("X-API-KEY", "YOUR_API_KEY") .post(requestBody) .build(); Response response = okHttpClient.newCall(request).execute(); JSONObject jsonObject = new JSONObject(response.body().string()); int status = jsonObject.optInt("status"); if (status != 200) { throw new Exception(jsonObject.optString("message")); } return jsonObject.getJSONObject("data").optString("task_id");}private static String pollingTaskResult(String taskId, int pollingTime) throws Exception { if (pollingTime >= 30) throw new IllegalStateException("Polling result timeout."); OkHttpClient okHttpClient = new OkHttpClient.Builder().build(); Request taskRequest = new Request.Builder() .url(" + taskId) .addHeader("X-API-KEY", "YOUR_API_KEY") .get() .build(); Response taskResponse = okHttpClient.newCall(taskRequest).execute(); JSONObject jsonObject = new JSONObject(taskResponse.body().string()); int state = jsonObject.getJSONObject("data").optInt("state"); if (state 0) { // Error. throw new Exception(jsonObject.optString("message")); } if (state == 1) { // Success and get result.
2025-04-10