curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Failed to use MathpixOCR JSON API with curl.

From: Hongyi Zhao via curl-users <curl-users_at_cool.haxx.se>
Date: Wed, 9 Jun 2021 11:15:46 +0800

Dear curl users,

According to the instruction given on the MathpixOCR API official
website here, <https://docs.mathpix.com/#request-parameters>, as shown
below:

curl -X POST https://api.mathpix.com/v3/text \
-H 'app_id: YOUR_APP_ID' \
-H 'app_key: YOUR_APP_KEY' \
-H 'Content-Type: application/json' \
--data '{ "src": "data:image/jpeg;base64,'$(base64 -i limit.jpg)'" }'


I use the following code with my own app_id and app_key to test the
OCR accuracy of MathpixOCR:

$ curl -x socks5://127.0.0.1:18888 -X POST
https://api.mathpix.com/v3/latex -H 'app_id: my_app_id' -H
'app_key: my_app_key' -H 'Content-Type: application/json'
--data '{ "url": "data:image/jpg;base64, '$(base64 -i
schrodinger.png)'" }'
{"error":"SyntaxError: Unexpected end of JSON
input","error_info":{"id":"json_syntax","message":"SyntaxError:
Unexpected end of JSON input"}}curl: (6) Could not resolve host:
AElEQVR4nO2dS2wb1
curl: (6) Could not resolve host:
kGRL8qY1SdkyChQJKdlSFwHMh+1FNxFJSUA2rUjJ3rRAxCHlRdMA4txvcf46vd
curl: (6) Could not resolve host:
Hr6Ohvfec+952iilhMPhcDgc62ixWgAOh8PhvO1wVcThcDgci+GqiMPhcDgWw1URh8PhcCyGqyIO
curl: (6) Could not resolve host:
h8PhWAxXRRwOh8OxGK6KOBwOh2MxXBVxOBwOx2K4KuJwOByOxfzCagE4HAuAIiM2m81qQbRg9ZMm
curl: (6) Could not resolve host:
lI3DOT74qYjzdlEoFEZHR997772Wlpa+vr7l5WWrJfof8Xi8u7u7paWlvb19dHQ0n89bLRGH0yBs
curl: (6) Could not resolve host: vAYdp3Y2Nzd
curl: (6) Could not resolve host: ZaW1tfXJkydjY2Otra2pVKq1tdVq0Tj
curl: (6) Could not resolve host: fmh99NFHqqpaLd3
curl: (6) Could not resolve host: 9eP8
curl: (6) Could not resolve host:
TVVVeJBOpy9cuGD4mo2NjUKhsLS0ND4+TggRRdHpdL58+TKdTvf39x+3hLFY7PHjx69evRIEwel0
curl: (6) Could not resolve host: gp0Qn3358iUhJJVKgSQ9PT0gMKWUD
curl: (6) Could not resolve host: evXq
curl: (6) Could not resolve host:
VvnjXuvBGJhOp0dGRux2e6FQuHPnzldffRWJREDx2Gy25eXl58+fd3d3o2yshJxmYHh4eHh4GP+r
curl: (6) Could not resolve host: qupf
curl: (6) Could not resolve host:
GAQDnSAIx21IdLlcLpeLNQPu7e3JsiyK4vr6uuFbvF4vIcTn8x2rYJxaKBaLbW1t3EBXF5orgi4U
curl: (6) Could not resolve host:
Cu3u7r5584a9eOHChdnZ2c3NzRs3blglGKeZoZTGYjGfzwf
curl: (6) Could not resolve host: hULHevKIxWKrq6v7+
curl: (6) Could not resolve host:
Uh0cHLBP7e3twXV+MGpCrD0VJZNJ8xFe6mARj8cJIaFQ6LglnJiYAEmi0Sh7vVgsguNBfzByOp2y
curl: (6) Could not resolve host:
LGMIA6c54aeiOtJEviKbzSbL8suXL6enp1nvNyEE41nT6fSlS5eskI7TpHR3d4OB7ubNm1tbW4SQ
curl: (6) Could not resolve host: Z8+esaccwxCGdDo9NjYWiURY0
curl: (6) Could not resolve host:
DqdZsFoXajHcXxwcHIC03HTehFjuK6KUFotFQRAIIbIsH+n4URRFkqRUKgX
curl: (6) Could not resolve host: eGgGcDqd+MrZ2VmPx4Mv4MHczQw
curl: (6) Could not resolve host: tNlssNzbDmFfmc
curl: (6) Could not resolve host:
o0eP4L+7u7sbGxvHKhiH0yQ0lypKJpOffvrp7u7utWvXPvvsM0LIw4cP0+k0BHZzOKV4
curl: (6) Could not resolve host: YWRkZHV1FaIVPB7PrVu3UNMUCoX+
curl: (6) Could not resolve host:
tbU9evRoaWkpGo2CKoLz3PLy8vj4eG9vL8Sa22y2QqGA3lMO55Rj8amMIRgMEkIkSWK9uAcHB3a7
curl: (3) URL using bad/illegal format or missing URL
curl: (6) Could not resolve host:
44HNFiEEshdAWg2zs7PHJxunRriBro40iypaX1+HuaePJsIgXUJIJpOxRDyOCZarInQUgeLB9B1I
curl: (6) Could not resolve host:
zWGHjaqqRR3Hl1SUy+UcDgchZHp6WvNUNBrFUQ1aSi8YX+CaHK6K6khTGOgopRDI5HK59PFOEIBE
curl: (6) Could not resolve host:
COno6OAFFzh60FEkSVI8Hod4S0opZhRhiesGFy+4cePG7u6uIAg3b97UPNXZ2YmP+
curl: (6) Could not resolve host:
5MfhNJKmGP2hUOj169eEEJfLpX92d3cXHvT09PAiKBw96Cjy+
curl: (6) Could not resolve host:
duvVDMYjOJ1OXnubw7FeFVFKl5aW4PHly5f1L8AoI15tgaOHUvrixQt4zIa3ZLNZDFezRDAo5UAI
curl: (6) Could not resolve host:
wZJ3LHhi83g8fIPF4TSFKoKaxLIs60tY4kLjdDq5dY6jhx0
curl: (6) Could not resolve host: EQRhaGiooZJxOE2J9aoIMbS
curl: (6) Could not resolve host: VwkhXq
curl: (6) Could not resolve host: FPBuDIIg6LdQi4uL+
curl: (6) Could not resolve host: 4Ha7KaULCwuSJEGgWmOA+nLwWDOwc7nc119
curl: (6) Could not resolve host: +9vfWCtKMpn87W9
curl: (6) Could not resolve host: 3NycmZlpcLT0rVu3BEHY2trKZrN4UVGUjz
curl: (6) Could not resolve host:
FVEoFLq7u3d2dqwSoJ63q5akJFVVDw4OotFoPB6PxWLZbLbqj5qZmSGEyLLs8
curl: (6) Could not resolve host:
1tgVAqpPQhpjdbmNiqJ0dnbC5tpCIAU4GAxaK4YhFqa4lqqTCwVPcZBbdd8ikYggCKIo+v1+v98
curl: (6) Could not resolve host: MjIiiqLdbi
curl: (6) Could not resolve host:
v7q+hMNhQRBqH9LlqqLt7e1IJKK5CAqjXhM+Fou53W6n0+l0Or1ebywWqz0Nnq3UoKecMkLQOea4
curl: (6) Could not resolve host: u3yWw
curl: (6) Could not resolve host:
drt+Wum74gYCAf1rNPchl8uJojgxMdHYP8IAqCMlSRLbddeQqlUR25utuqUJtsgul6ui7z0mJiYm
curl: (6) Could not resolve host: RFGssRROWapoe3sbbpBGA7tcLtZXXJeqPGwV
curl: (6) Could not resolve host: FovVS55yyOfzs7Oz+iOmqqo9PT2SJDVb
curl: (6) Could not resolve host:
QFzS4OBgOBzWd+XweDyCIDR4bCuKMjs7q29RqCgKtAUwf3stp6JkMgl3D9wTsDSFw2G4eGTXRJ
curl: (6) Could not resolve host:
JwhCgwuhwdKkXzZVVZUkqaenp5YPL0sVwX5co6vD4bDf72ePHfBfsLA1ePk+kmKxCEI6nc7yz7+i
curl: (6) Could not resolve host:
KDZ+3wG31HB7CIXLmq1pE1dFJ50aD464CJgbiyRJwlZMGmBgN97WBErU0JwzNTV15OmkLjXo0MjM
curl: (6) Could not resolve host: tq0yB84GjV8HwAxm+L2gIwztE2VSroFuenqa
curl: (3) URL using bad/illegal format or missing URL
curl: (6) Could not resolve host:
MbGGwXJvvo5Vqorih7AXS6mivb09eLHeQOJ2uwkhDbY8Y9FhTY15IJfLCYJQiy+j+rAFsDlg8eNv
curl: (6) Could not resolve host: v
curl: (6) Could not resolve host:
B0Z1qV0dLPqNjwxCDVpqjkPnEZMVvyJVVCwWcfvOng4NVVEsFsOlSXNoy+VyhJAarWFVgGl5e3t7
curl: (6) Could not resolve host:
hi8AXVC1M7v68FZI3MNSWl1dXWcYLKyM8Pz5cyg7trm5uby8bPLKe
curl: (6) Could not resolve host: PT0NjgCGkHFBELDHqAbInsGqaxxOjdCa80KwyjgUNdZ
curl: (6) Could not resolve host:
oa6RlpaWnZ0diFZYWlpKJpMmL56bm4OlKRqNjo+Ps0+trKwQQi5evFgXqcoHlqaOjo5SyXAdHR3k
curl: (6) Could not resolve host:
sKJVFRyxzoIyTKVSpZ6FNVGSpPb29mKxGIvF4vG4oijVSVMvRkZG4AHWZtZDmTKa+jpg8JT59FBV
curl: (6) Could not resolve host: VfP3qqqKB
curl: (6) Could not resolve host: xiKKosDMws
curl: (6) Could not resolve host:
EGmWpkQiUd3SdHBwALnkuDTpX4m75Co3NyYnplQqJUkStAtyuVx6mxtG1rlcLo
curl: (6) Could not resolve host:
tBigGDiC0UDHxlNqztf4lImjaH193eFw2O12uD+BQCCfz8uHOByOI8PzkCLT+U2D
curl: (6) Could not resolve host:
A92JpnYDXbFYhB2xfipB80BDxyf77fo3sgSDQVEUOzo6JEmCjB
curl: (6) Could not resolve host: yVZF2AIuTWhjxzvg9Xo1V
curl: (6) Could not resolve host:
FsjqxlJJVaQoisPhCAQCxWIRDoP6n4pNFxAEwefzRaNRcKkRSzNg0PyKcWj6XxdiowkhHR0dmt8b
curl: (6) Could not resolve host: YwdK
curl: (6) Could not resolve host:
4bgqOtHAZKlFFVFK0V6kCT2YmJgwd2XDdpZt+q4hGAzKspxMJlVV3dvbg+VVFMVwOJzP52EKlx9b
curl: (6) Could not resolve host: lM
curl: (6) Could not resolve host: C4Oo8Xbpl6ZydvAmlFRF09PTcGtMAifwJCTLMg5B
curl: (6) Could not resolve host: 7ejoYH9OCGaVJElV1Vr+fFDt+uw
curl: (6) Could not resolve host:
htz29rYkSWwSEix24PbHIPIq1j7YLw4MDJgM9SPX1ipUEQQdEGaXrFdF+tcgcEt7enoMxYY4LPaG
curl: (6) Could not resolve host: g
curl: (6) Could not resolve host: etbW1ra2tiilrCT4GOsm6dvJUFNb5
curl: (6) Could not resolve host:
MrTqEkJsNlupP7PBXbc5pwCHw6G5Qim9evXqxMTEhQsXqv7Yubk5p9OJITz0sDcVLHlgG3e73ZVW
curl: (6) Could not resolve host:
88PPaXxj6NbWVlmWNzc319bW5ubm2LmGD7Dcpd5XDatrqZm7uLjodDqxZzE99DlBPpDD4RAEobOz
curl: (6) Could not resolve host:
88qVK5WKjbfd5HZhCWDsu10RxqrIZrNhuUZorOLxeDSBEzs7OxAwMzAwwDZsRi+f3rH2m9
curl: (6) Could not resolve host:
fqpCSnOCwSDG8CDXr19fW1srFAoPHz5k1Qb+itB+QhCE0dFRzXux2bMh3d3diUQCfxJVVSE4An7v
curl: (6) Could not resolve host: 9vZ2KOZY6RDHyp5ltnrDip
curl: (6) Could not resolve host: V83FP
curl: (6) Could not resolve host: 4lwzHI2jo6NsO0SMn4Lt45UrV4rFYhUxroqiwK0wd
curl: (6) Could not resolve host:
EjyAYwAhRJKk4eHhij58aGhoeHgY76SiKKCK4M8cHh4eGhqqYtarqoqa2
curl: (6) Could not resolve host: viszHonYUwWup6SESv
curl: (6) Could not resolve host: iKaZLLZuw1NjdUv87u4uqPYjp4cmjL75AbNyRW
curl: (6) Could not resolve host: v4Lhs2UOM82pSFGUr7
curl: (6) Could not resolve host: Nj4+DvEX7LOzs7MvXrwQBCESiVS6kmh2b
curl: (6) Could not resolve host:
YRsGWJNFUcRUXIfDAaHeUPHJ8F1H+gZZwKFXe8nUMh1FtBJfET3MRK6UiiTnvqITTV18ReDDIIde
curl: (6) Could not resolve host: n4GBgTJXAHNfEYuqqrAhrr1kKjiKjvzS4
curl: (6) Could not resolve host: RxH7jdVVJCp5KgItNT8
curl: (6) Could not resolve host:
aCR37twZHR198uQJntXy+byqqoFAYGhoqNSW7UjdTiklh+4WQytqPB7XJwSYg44i3OhB7xbzbaM5
curl: (6) Could not resolve host:
sVjsq6++quKNrAWSwzkS1kIej8dfvnyZSqXqMoRUVYUZQY0ykAqFQjabLfNwgx+on7NVTNgaWVhY
curl: (6) Could not resolve host: uHHjxpMnT8ADQgjJ5
curl: (6) Could not resolve host:
zzY9PY0VmTCjiK1gAaFlcD2Xy8FrmqHqO62wHKp6WP3eMIgzEomIogh7BPxYNihlfX1dXyffPEga
curl: (6) Could not resolve host:
w0bxrAM1nQzfAnu6csJgMBazUo78ZBZ+KjrR1OVUhDGrhBDzRCINYEfp7Ow0nJVsaWAMB2XNMOyi
curl: (6) Could not resolve host:
BCiKEovFTEpW7+3twedgyeZoNKqfsJTJlyqVw9f4cqjmwb2BQEAURSihhEs0O50DgYDmcAO3y7y4
curl: (6) Could not resolve host: kWaJg0
curl: (6) Could not resolve host: YrEYDoc1w5pS6nK5NEdUjHovVbBcPczAxW
curl: (6) Could not resolve host:
v7aitR8mAli02FdC7qNhmWZRFEsVV8VaavAnq6oqy3Kp6sMm6z61QhWBtIa7ZJQW7j9mArG3S5Zl
curl: (6) Could not resolve host: zRYWEsJMug3F43HNDsDlcl27dk3
curl: (6) Could not resolve host:
oAkH5g9bRSaTgdo8WHdEFMXFxUXI5TTJOi5VdRSGgiAIoVBob2+vs7MTRga4nRRFGRkZ0UxFVB6k
curl: (6) Could not resolve host: dKFfPBU9e
curl: (6) Could not resolve host:
dHZ2atZENnaj1MkMjwsHBweKong8nlKVWOEcViqJh9amipLJJKxCX375JcjjcDhCoRBcNOlXBEYR
curl: (6) Could not resolve host:
w9oQkEaSSqXW19dFUQTFAJaVXC43ODio+UtVpkpTKQcPmGfgB1JV1e12f
curl: (6) Could not resolve host: SPMnmKkiRVEgWVeW5YsXL7IrI
curl: (6) Could not resolve host:
52ES9vT0CIIwMTGhH0bBYFAQBEEQTIY1HLAgNdrpdJZSkyBY+a1NGgBXRSeaeqkikz5b5pgUm4cG
curl: (6) Could not resolve host:
cb29vYIgBAKBdDoN1RbgiqGygZUair+Yi+pwOMz7xoJgJvFBlnRxhYXCUCoo14IlFfL5PCzgcMXk
curl: (6) Could not resolve host:
LYIgmCwpsKrD7XK5XKWWJhDsyArrcFcvXryoWQmPiKBTVTUWi+nDORRFKXWzoHFqpXa5XC4XiUR8
curl: (6) Could not resolve host: Pl8wGDQ
curl: (6) Could not resolve host:
z2KVKoIm9z6fLxaL1XHMNCEwDUOhEBS4rO+H10sVxeNxv99
curl: (6) Could not resolve host: 1efzmYeYbm9vm
curl: (6) Could not resolve host:
Y8GCWk5BMkNhqu9XVEcwttLpdMKhshkalcKJqo6V9Kanp2tsygKm8MY3GTOn8aoon89jdD7i9Xrr
curl: (6) Could not resolve host: vkxXDayY5ktAmUBnAa
curl: (6) Could not resolve host: x+OpsU4b1Bwyt86ZY70qcrvdPT09uVxOPaxSCsfnUr2HG
curl: (6) Could not resolve host:
5Uwmo6rqwcEBFteSZdlybZTL5TRV6mvUkT09Peh9yWQygiCIoqgPQKoF84N4A4CBbdjYuwrg3FDj
curl: (6) Could not resolve host:
dq1hDcWrAKz09VoHwMlU454bjHi1rG8WqyL4AyKRiOY6aCP9vgaSkxsWIA7D0fxYWibBYLCWLQPg
curl: (6) Could not resolve host:
dDrtdrvlq62GBqsiiFjVbAnRKWht8kA2m4XxCVsrUJPQaLm6Xw2OLKzugeNgs21HaufixYul7OGV
curl: (6) Could not resolve host: 4na7a9xBKooCfhHzl1mliiilXq
curl: (6) Could not resolve host: jjidztp790KB4brsO5onhhtpsCoCfy
curl: (6) Could not resolve host: S6iKYJfWyCnQGMAIUXs5
curl: (6) Could not resolve host: znqdjLH27PKNceuNdNrDT157NGCNvxNEZ9Zo
curl: (6) Could not resolve host:
rDmuSdIkjoNkMgm9dmr5EEVRarReBgKBMhdWC1URPbxdNa4J+Xye7cFRBWBcrX3SWXwqymazpZpW
curl: (6) Could not resolve host:
waxmbzSmvDW4KR+0Z62vr7hSZFmulyW97jT4VASeIUEQ2CnEqiI2rwUCF9mVQlXVvb09NigLKBaL
curl: (6) Could not resolve host: 29vb29vbVS8rmFSot5hDYE6NQSsAxK3U11fUPEDnaAv
curl: (6) Could not resolve host: WKrA+rAFSiksDT6fLxKJwFER7S3szhcLhtbFoFwRjf
curl: (6) Could not resolve host:
o1E4oIDVC88WkL8CF0VRrG5q5fN5n89n6LkFV1aNxnR6aJ0LhUK1fEiTc4LmmuWqiJ6o22WOWTnU
curl: (6) Could not resolve host:
BqAoyu3bt+fn5zs6OhwOx+bm5uTk5MzMDFtoLxgMvn79mh5W5WttbYX85M7Ozkr7eVQNrw3aVGiK
curl: (6) Could not resolve host: 4RNCstkslGL0eDznzp0jhFBKh4eHvV7v4ODg+++
curl: (6) Could not resolve host: 5ubm
curl: (6) Could not resolve host:
ikgkEvPz86FQaGxsrLpPOBHwuVYRp+d2WagGc7kcFNGZnp5G3Q4efqw3FQ6HId8IPQQdHR1wpTkd
curl: (6) Could not resolve host:
J28hzVBtATItWAdsNBqVJKlYLGL5S1mW2UxYbEfNRlsVi0W2klOlbG9vj4yMwEbK6XRCzj8aD6Fu
curl: (6) Could not resolve host: Ib44Go36
curl: (6) Could not resolve host: n
curl: (6) Could not resolve host:
PpM10Hk8HkmSJiYmwI3k8XjAW+73+wcGBjTR6tlsltVDqVSqXulunFrgqqiOWKaK4JSjr2JHmUJ2
curl: (6) Could not resolve host: bMs+kyZ+HGuxVhVtb2+DAtCEPK2vr0NggmGfNKw
curl: (6) Could not resolve host: amqqo6MD4ybwxL++vg6ZSaxgiqJ0dnbOzs4mEol4PB6Px2
curl: (6) Could not resolve host: hBW+DWH7yOk7y3E4+Xz+008
curl: (6) Could not resolve host:
zICnCmlra4N+84QQKCydyWQWFhZ2dnZaW1vZV7rd7gsXLvj9fmhfjYaB3t7era2tjY0N9sVwEORw
curl: (6) Could not resolve host: Tg0WqCJK6dzcHDy+fPmy
curl: (6) Could not resolve host:
yubmJtGpnOfPnxNCBEHo6urCi5TSx48fk8MexGWKQSkdGxsrFAqCIBgGFJw9e
curl: (6) Could not resolve host:
cHAQJVRVFdQMnI3GxsY2NzedTufVq1cJIRsbG6Io6qs4VxpSweE0O40
curl: (6) Could not resolve host:
wRlFnHKwykDn8XhkWWbTg8DTw1rq0FGkMaEYlu3QDDNFUcpJ2kcvpmHaECZrYxcrzZjHtzdJk0lO
curl: (6) Could not resolve host:
+XADXR2xwNhFKQWThcZmAmSzWbCo+P1+tMXhHraiJvacU8zIyMjGxkYikcDzECEEjhfs0RkO05qR
curl: (6) Could not resolve host:
pqoqjCjNaePJkyeEELvd3tXVRSkdHR1dXFw8UpKVlRV4gC4fFvgiQojX6wUZNGMeTIKSJPGDDudt
curl: (6) Could not resolve host:
xgIDHU5FiKDT8OjRI0KIJEnj4+N4ERcUvOL3+2VZvnLlyrGKymlOvF7v0tLStbHuoo4AAANgSURB
curl: (6) Could not resolve host:
VGvX7t27Rym12Wzw79bWFsYIkNKOot3dXb2jiFK6urpKCBkcHGxpaclms6urq9j81wR0BWlsgMDT
curl: (6) Could not resolve host: p08JIYIgDA0N6Z
curl: (6) Could not resolve host: FJnTLIRCoYWFBULI
curl: (6) Could not resolve host: xxrUND6fjz29xWKx7u7u1tZWeugEZdVYoVC4e
curl: (52) Empty reply from server
curl: (6) Could not resolve host: giBA6YQjgW
curl: (6) Could not resolve host: PFSqqn7wwQeEEL
curl: (6) Could not resolve host:
cNiw9XUmkwmHwxVFx2CwgybGAYqpayrwYxQDRExgVRH0e8O72IqunKaFhy3UEctSXKFbK+4l7Xa7
curl: (6) Could not resolve host: z+czaRAC
curl: (6) Could not resolve host:
m8vlIpEIVm7lND9cFdURiytzF4vFYrGo38wawov9NCdcFVFKp6en2YgJ6AJnGAueTCbBpud0OiHu
curl: (6) Could not resolve host: HOqCw5UmbI3IKQVXRXXERrlJmlMblNLf
curl: (6) Could not resolve host: uWezsbE5miuc5kdV1ffff7+lpeUf
curl: (6) Could not resolve host: ZTSRSPziF
curl: (3) URL using bad/illegal format or missing URL
curl: (6) Could not resolve host:
O4pqh4ctcDgcDsdiuDLncDgcjsVwVcThcDgci+GqiMPhcDgWw1URh8PhcCyGqyIOh8PhWAxXRRwO
curl: (3) unmatched close brace/bracket in URL position 39:
h8OxmP8H33PcSb71qNUAAAAASUVORK5CYII=" }
                                      ^

It seems that there are some errors in the json syntax used by me, but
I really can't spot them out. From my point of view, the test example
of mine is exatly same with the official sample code.

Any hints for fixing this problem?

Regards,
HY
-- 
Assoc. Prof. Hongyi Zhao <hongyi.zhao_at_gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
NO. 552 North Gangtie Road, Xingtai, China
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2021-06-09