bash - add a variable to binary inside string - linux

So I have a curl command in a bash script:
#!/bin/bash
curl -s 'http://eamorr.com/?' -H 'Host: eamorr.com' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:36.0) Gecko/20100101 Firefox/36.0' --data-binary $'-----------------------------1024109981087242139340277850\r\nContent-Disposition: form-data; name="target"\r\n\r\n90210\r\n-----------------------------102410998108724213934027785--\r\n'
This works fine for me.
Now, instead of 90210, I would like to try 90211
#!/bin/bash
postcode=90211
curl -s 'http://eamorr.com/?' -H 'Host: eamorr.com' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:36.0) Gecko/20100101 Firefox/36.0' --data-binary $'-----------------------------1024109981087242139340277850\r\nContent-Disposition: form-data; name="target"\r\n\r\n'$postcode'\r\n-----------------------------102410998108724213934027785--\r\n'
This won't work...
I think it's something to do with the $ in front of the --data-binary string? I tried dropping the $, but it wouldn't work.
I tried $(postcode), etc. to no avail

The problem is you now wrongly quote what follows the postcode. \r\n is not interpreted in single quotes, you need $'\r\n':
...'$postcode$'\r\n...

#!/bin/bash
postcode="90211"
curl -s 'http://eamorr.com/?' -H 'Host: eamorr.com' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:36.0) Gecko/20100101 Firefox/36.0' --data-binary $"-----------------------------1024109981087242139340277850\r\nContent-Disposition: form-data; name=\"target\"\r\n\r\n$postcode\r\n-----------------------------102410998108724213934027785--\r\n"
using quotation is a good practice, and "'$postcode'" is actually '90211' not 90211

Related

Is there a character limit for REST Here Maps routing api request?

This API works fine if I am passing around 50 or 60 waypoints.
I am currently getting Empty reply from server
"curl 'https://route.api.here.com/routing/7.2/calculateroute.json?jsoncallback=jQuery321030886563148208523_1588226597554&app_id=APP_ID&app_code=APP_CODE&mode=fastest%3Bcar%3B&waypoint0=13.055972866472336%2C%2078.01994197494206&waypoint1=13.056257412712744%2C78.02011212845024&waypoint2=13.056457444761685%2C78.02023351562264&waypoint3=13.056673405208578%2C78.02036456876203&waypoint4=13.056868110695888%2C78.02048270225077&waypoint5=13.057062549177289%2C78.02059859841785&waypoint6=13.057252151214083%2C78.0207095646235&waypoint7=13.057455761941554%2C78.0207915020337&waypoint8=13.057740204892355%2C78.02088635675757&waypoint9=13.058791164408287%2C78.02123470989947&waypoint10=13.059005907970324%2C78.02130568734867&waypoint11=13.059184445940936%2C78.02136469805717&waypoint12=13.059350674211414%2C78.02141960464354&waypoint13=13.059541107601396%2C78.0214825058419&waypoint14=13.059726559671525%2C78.02154376168286&waypoint15=13.060361195229719%2C78.02146559116646&waypoint16=13.060788240589602%2C78.019945082155&waypoint17=13.060865814169642%2C78.01969318808878&waypoint18=13.060958628882682%2C78.01942137351186&waypoint19=13.061059695388815%2C78.01914290214192&waypoint20=13.061165855105576%2C78.01885652857142&waypoint21=13.061271853921898%2C78.01856560679353&waypoint22=13.061377477100315%2C78.01827189159592&waypoint23=13.061490927804467%2C78.01798181184891&waypoint24=13.061603077079283%2C78.01771348277819&waypoint25=13.061713958757585%2C78.01748487382635&waypoint26=13.061761119751093%2C78.0173937423634&waypoint27=13.061764417413794%2C78.01738737013066&waypoint28=13.061763060648929%2C78.01738999187288&waypoint29=13.061763904121634%2C78.01738836198987&waypoint30=13.061770309413504%2C78.01737636193968&waypoint31=13.061788887350271%2C78.01734166838297&waypoint32=13.06271987921685%2C78.015601701824&waypoint33=13.062811301109639%2C78.01542277811033&waypoint34=13.062911739641459%2C78.01522620774233&waypoint35=13.063016699830074%2C78.0150205318817&waypoint36=13.06312453607604%2C78.01480868262749&waypoint37=13.06324032086656%2C78.01458078677975&waypoint38=13.063291938797324%2C78.01432378105397&waypoint39=13.063290958104332%2C78.01404624210745&waypoint40=13.063247505644636%2C78.01378723676622&waypoint41=13.063224431654243%2C78.01351650548693&waypoint42=13.0632314209409%2C78.0132458814278&waypoint43=13.063248747640435%2C78.01299459615882&waypoint44=13.063282739948368%2C78.01274138914167&waypoint45=13.06332379072634%2C78.01249627445624&waypoint46=13.063354485566494%2C78.01231536091063&waypoint47=13.063522707883003%2C78.01114308321519&waypoint48=13.063539265519093%2C78.01077608445995&waypoint49=13.06354830329796%2C78.01059931724072&waypoint50=13.063558779113528%2C78.01039979787036&waypoint51=13.063570513517206%2C78.01019689499198&waypoint52=13.063585757429564%2C78.00997676867613&waypoint53=13.063605629122156%2C78.00973312829262&waypoint54=13.063628478816375%2C78.0094919964221&waypoint55=13.063654228800601%2C78.00924381901922&waypoint56=13.063678988657387%2C78.00900985275085&waypoint57=13.063694494771383%2C78.00886332897811&waypoint58=13.06370299240077%2C78.00878303131505&waypoint59=13.063716484723836%2C78.00865553669719&waypoint60=13.063732081279467%2C78.00850815830351&waypoint61=13.063751001388036%2C78.00832147406369&waypoint62=13.06376634705606%2C78.00814285294018&waypoint63=13.063690629701984%2C78.00532314711427&waypoint64=13.063694121351578%2C78.0050738229828&waypoint65=13.0637123884021%2C78.00481625358222&waypoint66=13.063731164665892%2C78.00455150416342&waypoint67=13.063749539088677%2C78.00429242079052&waypoint68=13.063768171436823%2C78.00402970061371&waypoint69=13.063789398890064%2C78.00377847967032&waypoint70=13.06379338727618%2C78.00363041467779&waypoint71=13.063809396711237%2C78.00354634418898&waypoint72=13.063788148586697%2C78.00344416878931&waypoint73=13.06371447165782%2C78.00337359316461&waypoint74=13.063630359259493%2C78.00331190235727&waypoint75=13.063569506642468%2C78.00319899812155&waypoint76=13.064167681162305%2C78.00155991695635&waypoint77=13.064198358927912%2C78.00145296387188&waypoint78=13.064237502415724%2C78.00128733746521&waypoint79=13.06426960510487%2C78.00113017678075&waypoint80=13.064282471326239%2C78.00095608465188&waypoint81=13.064297097747273%2C78.00080982044153&waypoint82=13.064324841846771%2C78.00065886236541&waypoint83=13.064350406651444%2C78.00050480298512&waypoint84=13.064370607038088%2C78.00033599145524&waypoint85=13.064389131044097%2C78.00018779940717&waypoint86=13.06439780631388%2C78.0000808463227&waypoint87=13.06441226509685%2C77.99995302229934&waypoint88=13.064440009196348%2C77.99977708615177&waypoint89=13.064477099117882%2C77.99957407645695&waypoint90=13.064516494062788%2C77.99933460548334&waypoint91=13.06457353291387%2C77.99644687220267&waypoint92=13.064405224298186%2C77.99629088498465&waypoint93=13.064243746933586%2C77.99614747062138&waypoint94=13.064068104152627%2C77.99598989084176&waypoint95=13.063921253209061%2C77.99583055086246&waypoint96=13.06379489601875%2C77.99568277790955&waypoint97=13.06371061598236%2C77.9955182411503&waypoint98=13.063663425867505%2C77.99535563222877&waypoint99=13.063635388401396%2C77.99519436441174&waypoint100=13.063589371752984%2C77.99505664974264&waypoint101=13.063536481943972%2C77.99493402249924&waypoint102=13.063488369819767%2C77.99481282017938&waypoint103=13.063469803904242%2C77.99469379715434&waypoint104=13.06344059297169%2C77.99457804307154&waypoint105=13.063363311824448%2C77.99394872978142&waypoint106=13.0636705504852%2C77.99282689586094&waypoint107=13.06369888131792%2C77.99271726056746&waypoint108=13.063729014259822%2C77.99260259613207&waypoint109=13.063762960967667%2C77.99247971743158&waypoint110=13.063795273204393%2C77.99231333665362&waypoint111=13.063836051163323%2C77.99211510464362&waypoint112=13.063818616804726%2C77.99195744104496&waypoint113=13.063796656218416%2C77.99185518182627&waypoint114=13.063804367569334%2C77.99170841470173&waypoint115=13.063833913778014%2C77.99153088599256&waypoint116=13.063834332873173%2C77.99132100313714&waypoint117=13.06381492876733%2C77.99110315747372&waypoint118=13.06378144306416%2C77.99097206450811&waypoint119=13.064062446367986%2C77.9889589828234&waypoint120=13.06409559679503%2C77.98883333809486&waypoint121=13.064117557381339%2C77.98870660371891&waypoint122=13.0641644960391%2C77.98858489848486&waypoint123=13.06422388182307%2C77.98846411526016&waypoint124=13.064275220979995%2C77.98832598149589&waypoint125=13.064288673934586%2C77.98824358738771&waypoint126=13.06434407831455%2C77.98814107671193&waypoint127=13.064394537371642%2C77.98800998374632&waypoint128=13.064439296734578%2C77.98791174784115&waypoint129=13.064489504334576%2C77.98779339536837&waypoint130=13.064535311435408%2C77.98766867264918&waypoint131=13.064573993918545%2C77.98752249225787&waypoint132=13.064590045263119%2C77.9874015413951&waypoint133=13.065199451533207%2C77.98671430915407&waypoint134=13.065400910575935%2C77.98673283316008&waypoint135=13.065602579166242%2C77.98674582510999&waypoint136=13.065822939400622%2C77.98673945486358&waypoint137=13.066040114511797%2C77.98673165969363&waypoint138=13.066265378159532%2C77.98674155033937&waypoint139=13.066488755879053%2C77.98674473546258&waypoint140=13.06670924184198%2C77.98676443293503&waypoint141=13.066926333134125%2C77.98675873324088&waypoint142=13.067162744713078%2C77.98676158308795&waypoint143=13.06742304471607%2C77.98678035855106&waypoint144=13.067674250354122%2C77.98681564636341&waypoint145=13.067931993876647%2C77.98680617481283&waypoint146=13.06909649168427%2C77.9868124612402&waypoint147=13.072085520264759%2C77.98679100356809&waypoint148=13.072404367861404%2C77.98679930165223&waypoint149=13.072731178266064%2C77.98680366024188&waypoint150=13.073065616202609%2C77.98681681982985&waypoint151=13.073402694438652%2C77.98683400273136&waypoint152=13.073726152082042%2C77.98684825196675&waypoint153=13.074052124296383%2C77.98685772351733&waypoint154=13.074384843942777%2C77.98686141155473&waypoint155=13.074707798671978%2C77.98686593778244&waypoint156=13.075029160839575%2C77.9868608248215&waypoint157=13.075338285428542%2C77.98685194000414&waypoint158=13.075679931801814%2C77.98686183064989&waypoint159=13.077212227520604%2C77.98687943264655&waypoint160=13.080226317991578%2C77.98688764691165&waypoint161=13.080551829201244%2C77.98688999384454&waypoint162=13.080865899113082%2C77.98688915565423&waypoint163=13.081159978185855%2C77.98686845235339&waypoint164=13.081471491617226%2C77.98686258502117&waypoint165=13.081776131887995%2C77.9868613277357&waypoint166=13.08209854179349%2C77.98686241738311&waypoint167=13.082431261439885%2C77.98686157919279&waypoint168=13.082757610839868%2C77.98685881316474&waypoint169=13.083084421244527%2C77.98686258502117&waypoint170=13.083413997677232%2C77.986878007723&waypoint171=13.08376226575401%2C77.98685705296508&waypoint172=13.084097122785714%2C77.98685755587927&waypoint173=13.085383577284482%2C77.98682067550531&waypoint174=13.087544306193559%2C77.98687733717075&waypoint175=13.087794631731777%2C77.98690591946057&waypoint176=13.088064780470997%2C77.98696987338177&waypoint177=13.08833660559085%2C77.98711077317408&waypoint178=13.088614549500019%2C77.98727765686623&waypoint179=13.08890196495977%2C77.98745635904184&waypoint180=13.089187410672277%2C77.98764126382581&waypoint181=13.089479645726353%2C77.98784611753932&waypoint182=13.089799080056222%2C77.98802909448555&waypoint183=13.090148186323317%2C77.98815624795667&waypoint184=13.090476547380062%2C77.98826898455432&waypoint185=13.090799585928293%2C77.98838214024714&waypoint186=13.091111308907243%2C77.98846486963144&waypoint187=13.092410545808349%2C77.98881238333693&waypoint188=13.095299117279326%2C77.9881769512575&waypoint189=13.095620353718378%2C77.98808634288422&waypoint190=13.095949636784471%2C77.98799020245484&waypoint191=13.096291199338712%2C77.98789976171962&waypoint192=13.096643365000464%2C77.98781611032597&waypoint193=13.096989453782417%2C77.98770345754734&waypoint194=13.097327915032484%2C77.987596839739&waypoint195=13.097598147590736%2C77.98752467155269&waypoint196=13.097717044887224%2C77.98748737208358&waypoint197=13.097835145902911%2C77.9874480609577&waypoint198=13.09801342898337%2C77.98741134822181&waypoint199=13.09818056413261%2C77.98735267489961&waypoint200=13.099056850199679%2C77.98711437739244&waypoint201=13.101534373139126%2C77.98639873049966&waypoint202=13.101731180225594%2C77.98634667888096&waypoint203=13.101955647592527%2C77.98630837358347&waypoint204=13.10220329092173%2C77.98629730947128&waypoint205=13.102461118263287%2C77.98629236414841&waypoint206=13.102724310022873%2C77.98629881821385&waypoint207=13.103008456540389%2C77.98630284152738&waypoint208=13.10329084285824%2C77.98631792895308&waypoint209=13.103572055709645%2C77.9863237962853&waypoint210=13.103757505317315%2C77.98633879989198&waypoint211=13.103830134508296%2C77.98632756814173&waypoint212=13.103922419262215%2C77.9863237962853&waypoint213=13.10406461824952%2C77.98628641299716&waypoint214=13.104235441436156%2C77.98627266667596&waypoint215=13.105128323671506%2C77.98636788509599&waypoint216=13.109599272732725%2C77.9868801031988&waypoint217=13.110013296839883%2C77.98694824807158&waypoint218=13.110417849396457%2C77.98702117062918&waypoint219=13.110817163263551%2C77.98709325499645&waypoint220=13.11118211132764%2C77.98714865937642&waypoint221=13.111510765750996%2C77.98721043400279&waypoint222=13.11181586702644%2C77.98726659275404&waypoint223=13.112140623864821%2C77.98732694245687&waypoint224=13.112495304097525%2C77.9873930756729&waypoint225=13.112862682913535%2C77.98748175620845&waypoint226=13.113233288762265%2C77.98756817363015&waypoint227=13.113610264857405%2C77.9876642302405&waypoint228=13.113996712503129%2C77.98774084083549&waypoint229=13.114385590900772%2C77.98783027574233&waypoint230=13.114757370215948%2C77.9879229795914&waypoint231=13.116093026486332%2C77.98831349246016&waypoint232=13.115928196360464%2C77.98827677972427&waypoint233=13.115730509174163%2C77.98823453493229&waypoint234=13.11551777647167%2C77.9881854169797&waypoint235=13.115280359064336%2C77.98813537701777&waypoint236=13.11500958168238%2C77.98807427294365&waypoint237=13.114717556175883%2C77.98800579279474&waypoint238=13.11439552345603%2C77.98793236732295&waypoint239=13.114078897063726%2C77.98785919330827&waypoint240=13.113762941223674%2C77.98779364682547&waypoint241=13.113460522157245%2C77.98772089190594&waypoint242=13.11315412168681%2C77.98766464933566&waypoint243=13.112862179999345%2C77.98759440898708&waypoint244=13.112567975198022%2C77.98753380782715&waypoint245=13.112524137844435%2C77.98753481365553&waypoint246=13.112510140066139%2C77.9875400104355&waypoint247=13.112042555597714%2C77.98746163964084&waypoint248=13.111893399630777%2C77.98741461716405&waypoint249=13.11173087452828%2C77.98737639568559&waypoint250=13.11155129225283%2C77.98734387390128&waypoint251=13.111373051081888%2C77.98729542650095&waypoint252=13.111216477130643%2C77.98726801767758&waypoint253=13.111184416351012%2C77.98726608983985&waypoint254=13.111180309218458%2C77.98726282089761&waypoint255=13.111173897062532%2C77.98727874651364&waypoint256=13.111173897062532%2C77.98727874651364&waypoint257=13.111173897062532%2C77.98727874651364&waypoint258=13.111173897062532%2C77.98727874651364&waypoint259=13.111173897062532%2C77.98727874651364&waypoint260=13.111182865698925%2C77.98727028079144&waypoint261=13.11114133336871%2C77.9872530140709&waypoint262=13.109233360749771%2C77.98768920831195&waypoint263=13.109377403755774%2C77.98777805648557&waypoint264=13.109578611341407%2C77.98779892742446&waypoint265=13.109800815594484%2C77.98785567290894&waypoint266=13.110049171385457%2C77.98789875589124&waypoint267=13.11031240505456%2C77.98794435344449&waypoint268=13.110585529369404%2C77.98799338757804&waypoint269=13.110847296205453%2C77.98803890131227&waypoint270=13.111015604821137%2C77.98809464096836&waypoint271=13.11106971000611%2C77.9882393126171&waypoint272=13.111062669207445%2C77.98834500841609&waypoint273=13.111062669207445%2C77.98834500841609&waypoint274=13.111062669207445%2C77.98834500841609&waypoint275=13.111062669207445%2C77.98834500841609&waypoint276=13.111059316446177%2C77.98833503395132&waypoint277=13.111059316446177%2C77.98833503395132&waypoint278=13.111059316446177%2C77.98833503395132&waypoint279=13.111059316446177%2C77.98833503395132&waypoint280=13.111059316446177%2C77.98833503395132&waypoint281=13.111059316446177%2C77.98833503395132&waypoint282=13.111059316446177%2C77.98833503395132&waypoint283=13.111059316446177%2C77.98833503395132&waypoint284=13.111059316446177%2C77.98833503395132&waypoint285=13.111059316446177%2C77.98833503395132&waypoint286=13.111059316446177%2C77.98833503395132&waypoint287=13.111059316446177%2C77.98833503395132&waypoint288=13.111059316446177%2C77.98833503395132&waypoint289=13.111059316446177%2C77.98833503395132&waypoint290=13.111059316446177%2C77.98833503395132&waypoint291=13.111059316446177%2C77.98833503395132&waypoint292=13.111059316446177%2C77.98833503395132&waypoint293=13.111059316446177%2C77.98833503395132&waypoint294=13.111059316446177%2C77.98833503395132&waypoint295=13.111059316446177%2C77.98833503395132&waypoint296=13.111059316446177%2C77.98833503395132&waypoint297=13.111059316446177%2C77.98833503395132&waypoint298=13.11105139554768%2C77.98834031455031&waypoint299=13.11105139554768%2C77.98834031455031&waypoint300=13.11105139554768%2C77.98834031455031&waypoint301=13.11105139554768%2C77.98834031455031&waypoint302=13.11105139554768%2C77.98834031455031&waypoint303=13.11105139554768%2C77.98834031455031&waypoint304=13.11105139554768%2C77.98834031455031&waypoint305=13.11105139554768%2C77.98834031455031&waypoint306=13.11105139554768%2C77.98834031455031&waypoint307=13.11105139554768%2C77.98834031455031&waypoint308=13.11105139554768%2C77.98834031455031&waypoint309=13.11105139554768%2C77.98834031455031&waypoint310=13.11105139554768%2C77.98834031455031&waypoint311=13.11105139554768%2C77.98834031455031&waypoint312=13.11105139554768%2C77.98834031455031&waypoint313=13.11105139554768%2C77.98834031455031&waypoint314=13.11105139554768%2C77.98834031455031&waypoint315=13.11105139554768%2C77.98834031455031&waypoint316=13.11105139554768%2C77.98834031455031&waypoint317=13.11105139554768%2C77.98834031455031&waypoint318=13.11105139554768%2C77.98834031455031&waypoint319=13.11105139554768%2C77.98834031455031&waypoint320=13.11105139554768%2C77.98834031455031&waypoint321=13.11105139554768%2C77.98834031455031&waypoint322=13.11105139554768%2C77.98834031455031&waypoint323=13.11105139554768%2C77.98834031455031&waypoint324=13.11105139554768%2C77.98834031455031&waypoint325=13.11105139554768%2C77.98834031455031&waypoint326=13.11105139554768%2C77.98834031455031&waypoint327=13.11105139554768%2C77.98834031455031&waypoint328=13.11105139554768%2C77.98834031455031&waypoint329=13.11105139554768%2C77.98834031455031&waypoint330=13.11105139554768%2C77.98834031455031&waypoint331=13.11105139554768%2C77.98834031455031&waypoint332=13.11105139554768%2C77.98834031455031&waypoint333=13.11105139554768%2C77.98834031455031&waypoint334=13.11105139554768%2C77.98834031455031&waypoint335=13.11105139554768%2C77.98834031455031&waypoint336=13.11105139554768%2C77.98834031455031&waypoint337=13.11105139554768%2C77.98834031455031&waypoint338=13.11105139554768%2C77.98834031455031&waypoint339=13.11105139554768%2C77.98834031455031&waypoint340=13.11105139554768%2C77.98834031455031&waypoint341=13.11105139554768%2C77.98834031455031&waypoint342=13.111054454942337%2C77.98833981163612&waypoint343=13.111054454942337%2C77.98833981163612&waypoint344=13.111054454942337%2C77.98833981163612&waypoint345=13.111054454942337%2C77.98833981163612&waypoint346=13.111054454942337%2C77.98833981163612&waypoint347=13.111054454942337%2C77.98833981163612&waypoint348=13.111054454942337%2C77.98833981163612&waypoint349=13.111054454942337%2C77.98833981163612&waypoint350=13.111054454942337%2C77.98833981163612&waypoint351=13.111054454942337%2C77.98833981163612&waypoint352=13.111054454942337%2C77.98833981163612&waypoint353=13.111054454942337%2C77.98833981163612&waypoint354=13.111054454942337%2C77.98833981163612&waypoint355=13.111054454942337%2C77.98833981163612&waypoint356=13.111054454942337%2C77.98833981163612&waypoint357=13.111054454942337%2C77.98833981163612&waypoint358=13.111054454942337%2C77.98833981163612&waypoint359=13.111054454942337%2C77.98833981163612&waypoint360=13.111054454942337%2C77.98833981163612&waypoint361=13.111071637843839%2C%2077.98834752298704&_=1588226597556' \
-H 'authority: route.api.here.com' \
-H 'user-agent: Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Mobile Safari/537.36' \
-H 'accept: */*' \
-H 'sec-fetch-site: cross-site' \
-H 'sec-fetch-mode: no-cors' \
-H 'sec-fetch-dest: script' \
-H 'referer: http://localhost:4200/trips/887_1585385671783' \
-H 'accept-language: en-GB,en-US;q=0.9,en;q=0.8' \
-H 'cookie: CONSENTMGR=ts:1581564470018%7Cconsent:true; _fltpm=true; s_fid=05454FE372A3D148-11F9D40EA74745B3; _mkto_trk=id:142-UEL-347&token:_mch-here.com-1581564470096-99796; _gcl_au=1.1.1412298891.1581564470; _biz_uid=ba693477264c4199acb60ece8447f9c7; locale=en-GB; s_prop56=16; AMCV_E16CD4415481B5550A4C98A2%40AdobeOrg=432708069%7CMCMID%7C24083277236489400023934932908985334942%7CMCAAMLH-1587982682%7C12%7CMCAAMB-1587982682%7Cj8Odv6LonN4r3an7LhD3WZrU1bUpAkFkkiY1ncBR96t2PTI%7CMCAID%7C2F22611B0515B580-600001608027327E; _biz_flagsA=%7B%22Version%22%3A1%2C%22Mkto%22%3A%221%22%2C%22XDomain%22%3A%221%22%2C%22Ecid%22%3A%221848617127%22%7D; s_nr=1587378302681-New; here_ca_access=true; here_access=h1.MzBBUHtVknhNkwaM0rzrxg.rtwqWTFI4P_F0YrBULGrDcLVPAirKmXNySGYWYvA7blxcoQ7aFaDjUmo1najNWTqbCj18OxQo5iGReqyd2Sj6cp_q750M97-Y65s2ojzK3CQwYo7Lj9U5hpGFwz6SJqk6oUVKTlY34gmYkkUoreuOEWpeTnJeY-yexGvRCLtljr1wBUjU2USN4bMV1ICVatK3spwiosVYyuUeZV1ZwDGCkXAwIEK9jec4oJ0RqjVH8BgeSAPg8Sw7CYU5OUNkYHWQVDqXTvS6vJAJivnGyrQaBm0OknmeXqDqmDxQqJDEGIO7dxZx_y39MgeWW0y2OT7QL5OuAWv97nnV6M49vL02sS1A3ExdBag0FAJ2jmH9JnKCiigg8PP7J7BkVTkkIksBlgBGP-ZPIqEH_bStIMmBcp8f7OneGK-xGNU2s3Mg-z7pj7kwkqeMVhk744_7ySYmiK8_Ayy-3DfbtBD7PsLyw.USo_8r7LQMpjI4x3SPekANBSyiq8zqm2ymqjC1Df_YjyJj8s8mgHPt26MraCLqRToGkCpwi8uVFz0VK4mcVvHySUpo2Piuv4zOLOcTjyvsiI0E2qbScFkAcqGvWdniFZ0fU8Y7qbVkOrp9A2JW7NDPrmhR5LZGuyKt0UQO-8BW13oD5qS6Ntcd61AtkNwuzT0ClD6GTehOCnnf6Rw7ea2RGoVNTc0vGzE8X39a3OF4cRx1mB6oc4zfQLwoNsaXSyh6i1aUBRQNKEpnW77L9UMOJLzhtMirH1WhhxaIetdgn_OnmDBw_CDGCt1nZ4CnZFsh-UPmgGHLyk2S-Hhv6wAg; here_auth=XzR4wWWedkxaVG67Y%2FDe0GtuMm5QWnpzTWM0dHIgB90DjehXuMUtxJQkq0dW6fWFNmm5X2uQC3E0%2FZ0U7eHlG3z1UKAutXU1Z9cQ5HvA%2BK40Bp3bqxHn40o3I0513PAVOVTFChgsyZ%2BuhNu4qTzDMonCJAykjQCb8Lry%2BK8R1zpg6tyYNWZsP9n%2BBRteM7tVvUll9D0XVFF0t9rSvYkMCIUjClgROupBLN7ok9Hb81gSBH0Z1R7wnNRkSkrZJb3kSwmIBo7fyHPbf2%2BF7dGCTv1xoTNpTBkCVkV41Bd8mSSt47%2BHhbJ%2FnEpeVjdBAaQ5pK%2FPr9W5sVBLhA%3D%3D; s_cc=true; s_sq=%5B%5BB%5D%5D; utag_main=v_id:01703c96a2130016de75df0ea7d70307900490710093c$_sn:14$_ss:0$_st:1588173371414$vapi_domain:here.com$ses_id:1588169854112%3Bexp-session$_pn:9%3Bexp-session; _totalpageviews=9; _biz_nA=77; _biz_pendingA=%5B%5D' \
--compressed"
This is a good question and I expect HERE maps support can answer this properly and hope eventually we will have information in the docs. I also have similar behavior when having too many waypoints. The only info I found in terms of docs is here and it's android SDK docs.
A quote from the mentioned source:
While there is no maximum limit imposed on how many waypoints are allowed for a route, increasing the number of waypoints increases the probability that the route request will fail and a safe upper limit of 128 is recommended.
I believe a similar approach works for REST API as well. But let's wait HERE Developer Support answer

Curl: Send request just like a browser

Searching theatres on Google returns future events in an instant panel. See the Showtimes panel below for example:
I am trying to pull Google instance information using curl. However, it seems Google somehow figures that this is a bot not a real browser request. Response received by curl has the instant panel excluded. Here is the curl call I use:
curl -H "DNT: 1" -H "UPGRADE-INSECURE-REQUESTS: 1" \
-H "Accept-Language: en-US,en;q=0.9,fa;q=0.8" \
-H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" \
-H "REFERER: https://www.google.com/" \
-H "X-ACCEL-INTERNAL: /internal-nginx-static-location" \
-H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" \
-v "https://www.google.com/search?q=rio+theatre&oq=rio+theatre&aqs=chrome..69i57j0l5.2382j1j7&sourceid=chrome&ie=UTF-8"
How can I modify curl to retrieve the same information as the browser does?

How to send same cookies to every curl command?

I am testing curl, and very new to this language.
let me explain what I m doing.
"http://somewebsite.com/click?param1=10&param2=523" this is the url which I am hitting in the browser and using Inspect Element and I got the following curl bash value --
curl 'http://somewebsite.com/click?param1=10&param2=523' -H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Mobile Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.9' -H 'Cookie: pdval=9bc5d1fa982ff4c1e1f3d224' --compressed
Now here every time I hit that url in the browser, the value of parameter "pdval" is changing.
Is there any option to read the -H values in a bash script in Linux using curl.
Any help will be great. Thank you.
Since pdval is in cookie, you can make use of -b and -c options for cookie related task.
-c, --cookie-jar < filename >
(HTTP) Specify to which file you want curl to write all cookies after
a completed operation. Curl writes all cookies from its in-memory
cookie storage to the given file at the end of operations. If no
cookies are known, no data will be written. The file will be written
using the Netscape cookie file format. If you set the file name to a
single dash, "-", the cookies will be written to stdout.
-b, --cookie < name=data >
(HTTP) Pass the data to the HTTP server in the Cookie header. It is
supposedly the data previously received from the server in a
"Set-Cookie:" line. The data should be in the format "NAME1=VALUE1;
NAME2=VALUE2".
If no '=' symbol is used in the argument, it is instead treated as a
filename to read previously stored cookie from.
So if you set the -c option, then curl will automatically stores the cookie in a file. And you have to use -b to tell curl that take cookies from that file.
So you command should be as follows:
curl 'http://somewebsite.com/click?param1=10&param2=523' -H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Mobile Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.9' -b /tmp/somewebsite.cookie -c /tmp/somewebsite.cookie --compressed

Bash Linux Curl send headers from variable

I have some script in bash.
I want to send a request to server with some headers (cloudflare block :).
I wrote this:
headers="\
-H 'Host: somesite.com' \
-H 'Accept-Language: pl,en-US;q=0.7,en;q=0.3' \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' \
-H 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0' \
-H 'Accept-Encoding: gzip, deflate' \
-H 'DNT: 1' \
-H 'Connection: keep-alive'";
curl $headers somesite.com
But in output I'm have this..
curl: (6) Couldn't resolve host 'Accept-Language'
curl: (6) Couldn't resolve host 'pl,en-US;q=0.7,en;q=0.3'
curl: (6) Couldn't resolve host 'Accept'
curl: (6) Couldn't resolve host 'text'
curl: (6) Couldn't resolve host 'User-Agent'
curl: (6) Couldn't resolve host 'Mozilla'
curl: (6) Couldn't resolve host '(Windows'
curl: (6) Couldn't resolve host 'NT'
curl: (6) Couldn't resolve host '6.1;'
How can I put headers from variable into command ?
Don't use a string for this. Trying to get quoting correct in a string like this is essentially impossible, use an array.
See http://mywiki.wooledge.org/BashFAQ/050 for more.

Curl Ubuntu Post Request Doesn't receive file

So I'm trying to download ventrilo from their website
http://www.ventrilo.com/dlprod.php?id=102
As far as I'm aware what I'm showing is identical to the request that the page makes when you click accept, does anyone know why this isn't working?
curl -o ventrilo.tar.gz "http://dlx2.ventrilo.com/dl.php?server_linux_i386&8882453279444" -H
"Origin: http://www.ventrilo.com"
-H "Accept-Encoding: gzip,deflate,sdch"
-H "Accept-Language: en-US,en;q=0.8"
-H "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36(KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36"
-H "Content-Type: application/x-www-form-urlencoded"
-H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
-H "Cache-Control: max-age=0" -H "Referer: http://www.ventrilo.com/dlprod.php?id=102"
-H "Connection: keep-alive" --data "Download=I+Agree" --compressed
Notice this bold number from your POST url server_linux_i386&8882453279444. Using the number they are tracking the session.
There are two things can happen:
1) May be you have collected the url from the page's source and tried after a long time when the session is expired.
2) May be you collected the url from your pc and tried to execute at your server(or vice-versa).

Resources