download from webpage and change url

Welcome Forums General PowerShell Q&A download from webpage and change url

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
7 months ago.

  • Author
    Posts
  • #109544

    Participant
    Points: 5
    Rank: Member

    Hi everyone. I want use this code

    Start-Process "http://www.overpass-api.de/api/xapi?map?bbox= 5.974899,50.662127,6.218150, 50.857233

     

    but I'dlike toaks user to enter bbox i tried like that but it didnt work well and the result was not ok. Please how can i write it in good way:

    $minLon = Read-Host "Pleas enter minLon"
    $minLat = Read-Host "Pleas enter minLat"
    $maxLon = Read-Host "Pleas enter maxLon"
    $maxLat = Read-Host "Pleas enter maxLat"
    $bbox = $minLon,$minLat,$maxLon,$maxLat

    Start-Process "http://www.overpass-api.de/api/xapi?map?bbox= 5.974899,50.662127,6.218150, 50.857233

    Thanks very much.

  • #109564

    Participant
    Points: 639
    Helping Hand
    Rank: Major Contributor

    You are building bbox as an array. You need to build a string with comma delimited values to build the url. There are many ways to do things, but you could something like this to fill in the blanks in the URL:

    $minLon = Read-Host "Pleas enter minLon"
    $minLat = Read-Host "Pleas enter minLat"
    $maxLon = Read-Host "Pleas enter maxLon"
    $maxLat = Read-Host "Pleas enter maxLat"
    $url = 'http://www.overpass-api.de/api/xapi?map?bbox={0},{1},{2},{3}' -f $minLon,$minLat,$maxLon,$maxLat
    
    Start-Process $url
    
    • #109613

      Participant
      Points: 5
      Rank: Member

      Thank you very much. It worked very good.

The topic ‘download from webpage and change url’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort