$ErrorActionPreference = "Stop" $appcode = "e3bdae1a73d2415492e7fdc024f07d08" $url = "https://swcardpack.market.alicloudapi.com/ocr/idcard" $imgUrl = "https://bbit-f8-web.oss-cn-chengdu.aliyuncs.com/uploads/idcard/202608/7f0c397e0c494e4fa5c6481fc5e6bc32.jpg?Expires=1786613281&OSSAccessKeyId=TMP.3KwrhonVXVt12i8MCDjV4C2pP4DTvz83YikWKjsyUR3rpz6Up5tYdjiaU6FYjgSMetNvfiw65dqZ7GrHknpsvbE4LpFGis&Signature=nIfh556Er3%2FRPFGm2qJLfYPHaYQ%3D" try { $resp = Invoke-WebRequest -Uri $url -Method Post ` -Headers @{ Authorization = "APPCODE $appcode" } ` -ContentType "application/x-www-form-urlencoded; charset=UTF-8" ` -Body @{ image_url = $imgUrl } -UseBasicParsing Write-Output ("HTTP " + [int]$resp.StatusCode) Write-Output $resp.Content } catch { $r = $_.Exception.Response if ($r) { $reader = New-Object System.IO.StreamReader($r.GetResponseStream()) Write-Output ("HTTP " + [int]$r.StatusCode) Write-Output $reader.ReadToEnd() } else { Write-Output ("ERROR: " + $_.Exception.Message) } }