| $info='互助互利,支付宝扫码头像,感谢赞助'; | | Add-Type -AssemblyName System.Web; | | $url='https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic'; | | $pic='C:\Users\Administrator\Desktop\test.jpg'; | | $imagedata=[Web.HttpUtility]::UrlEncode([Convert]::ToBase64String([IO.File]::ReadAllBytes($pic))); | | $poststr=@( | | 'access_token=24.b305c9822131e65eda05e29c157dd719.2592000.1559103982.282335-16139329', | | $('image='+$imagedata), | | 'language_type=CHN_ENG', | | 'detect_direction=false', | | 'detect_language=false', | | 'probability=false' | | ) -join '&'; | | $web=New-Object System.Net.WebClient; | | $web.Headers.Add('Content-Type', 'application/x-www-form-urlencoded'); | | [byte[]]$postdata=[Text.Encoding]::UTF8.GetBytes($poststr); | | [byte[]]$responsedata=$web.UploadData($url, 'POST', $postdata); | | [Text.Encoding]::UTF8.GetString($responsedata);COPY |
|