概述路径和php $ _POST

In google maps response there is an array with a key called overview_path with an encoded value e.g. ioffIbei@GzvFez@p_@uMjjBdhAvo@gBvdCp|@jgEpuBxpMyrCf}@oyDhjCcqAdb@}~ <--way longer

With jQuery i have put this value into an input text field and submitted the form using method post. I want to display the static map on the post page but a completely different map is showing.

    $polyline = $_POST['polyline'];
   echo "<img src='http://maps.googleapis.com/maps/api/staticmap?size=400x400&path=enc:".$polyline."&sensor=false' />";

When i test the url in the browser the correct map shows but not on the POST page. i assume the encoding has been changed. How do i solve this?

The complete polyline is ioffIbei@GzvFez@p_@uMjjBdhAvo@gBvdCp|@jgEpuBxpMyrCf}@oyDhjCcqAdb@}~@qPuaCzs@k~@{l@suClDqo@c@cnA|BaBvc@oh@oTke@o}Bqz@q^wdDfHk{Auo@{NfOk_@vnA{yAtBetBv_@yCcBy~@hmAgeAtr@_cAtw@sp@pYms@sm@kuBh]orAvd@k{CjM}aBzt@woBfnDsI~Xbo@qwAbxAmbClhBai@rkCaE~gAjRppAbvCh~@hnIkArmDg@|[hg@dCf~@|lAda@laAzfA~wE~DttCxPf|Blc@rcBnbAfWxyAf~AhyB~mBrqA|w@pnAiCfqCvtD~Y~_AvXeo@tfAxeBfzBjeFhxBhnHhxAoOffG|\dtChfCd{Bs]noBpjAv{KrzJnfAhzCrGzdHzq@lbBsAwaB|yBoyCtCqBhiDomBjw@syA~eAoXd{@wPnaAurArqBe{@dfBe@pmCfE|pB_mHto@sgDzcBuFjr@etAxhAei@tDswDnbC{vFryCk|BfvAeWpyBzu@faAlSp{@mb@ryBk{DhlCu|AveA|WfdAfv@hoAeo@roCmm@vyA|E~w@qy@ry@q}Cde@qvChh@e{AaBgo@h}A~EndCsr@vmAwtAxb@guAj}Ai_BpaB{TdcEvKtvCqzBj}GyLlvHatBzlD}HgCkgDfxByhCbeAebDdbBstDrrCssCljA_m@l@_qAh{@egDxa@y{CbhCaaDhbC}hCzcAcQjkAmq@biB_AbtIejBfwGizA|xEyNtuDud@pxApjAfsAzNoCj^~uDvxDf}@~c@h|@e[lgBn\zi@b]x@eEfxBaKjyEsR{Am_BnmByv@tAyZlh@k_DfyIghFvfAsi@v~AqItkBmMrz@vj@wb@||@ge@hMbT|eApa@xdAqa@ydAkU{dA~[gI~i@sdA|t@vq@v_EvfAxy@lc@noAog@ldCwpBlsB}g@~{@yAlwA~y@viAn]dcAfwAvnAlTpeBqTjjArVreBhBllC{s@p{@_cAvt@}Bvm@sXf_AhWflCxlAbaEniBtCzDb@wfApcAaUj|A_lFenBsiIiCweChp@uhAlr@m{@zhBoi@hXeUeQeq@nAyuAz}@}wA|_B_fAwC}j@xWst@vyAoeBn~Ayi@|Ak_AdhBkuB~eC{z@l]wiAlYh@zUp_AhSpfA|w@g]jbAsQi{Bzo@qVxhBoj@jk@yOnLaTbDcZtt@cv@z}AoT|sBgbAdvCc_@~dCg@r{C_j@hH

The encoded polyline contains characters which need to be urlencoded when you use them in a url(e.g. the @ in your example).

   echo '<img src="http://maps.googleapis.com/maps/api/staticmap?'
          .http_build_query(array(
            'size'=>'400x400',
            'path'=>'enc:'.$_POST['polyline'],
            'sensor'=>'false'
          ),'','&amp;').'" />';

Solved it a second backslash is being added to the string. I used stripslashes and the correct map is showing.