Results 1 to 3 of 3

Thread: URL encoding problem ?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2010
    Location
    http://bbat.forumeiro.com/
    Posts
    86

    Question URL encoding problem ?

    Hi
    I am trying to test a download of a mp3 file from this URL:
    Code:
    http://promodj.com/download/4126268/Chris%20Parker%20-%20Life%20MIX%20%282011%20-%202013%29%20%28promodj.com%29.mp3
    but I encounter an Access Denied error at line No. 26, knowing that the url works in all browsers?
    Can anyone here tell me what's my mistake ?
    PHP Code:
    Option Explicit
    Dim Titre
    ,objFSO,Ws,objXMLHTTP,PathScript,Tab,URL,strHDLocation,objADOStream,Command,Start,File,ExempleURL
    Titre 
    "Downloading MP3 by © Hackoo 2013"
    Set objFSO Createobject("Scripting.FileSystemObject")
    PathScript objFSO.GetParentFolderName(wscript.ScriptFullName'Chemin ou se localise le Vbscript
    Set Ws = CreateObject("wscript.Shell")
    ExempleURL = "http://promodj.com/download/4126268/Chris%20Parker%20-%20Life%20MIX%20%282011%20-%202013%29%20%28promodj.com%29.mp3"
    URL = InputBox("Tapez ou collez l'
    URL dans le champ de saisie Exemple "&Dblquote(ExempleURL)&"",Titre,ExempleURL)
    URL = Escape(URL)
    msgBox URL
    If URL = "" Then WScript.Quit
    Tab = split(url,"
    /")
    File = Replace(Tab(UBound(Tab)),"
    28","")
    File = Replace(Tab(UBound(Tab)),"
    29","")
    File = Replace(Tab(UBound(Tab)),"
    20","")
    File = Replace(Tab(UBound(Tab))," ","
    _")
    File = Replace(Tab(UBound(Tab)),"
    -","_")
    File = Replace(Tab(UBound(Tab)),"
    (","_")
    File = Replace(Tab(UBound(Tab)),"
    )","_")
    File = Replace(Tab(UBound(Tab)),"
    %","_")
    Msgbox  "
    The download of " & Dblquote(File) & " is in progress ",64,"The download of " & Dblquote(File) & " is in progress "
    strHDLocation = PathScript & "
    \" & File
    Set Ws = CreateObject("
    WScript.Shell")
    Set objXMLHTTP = CreateObject("
    MSXML2.XMLHTTP")
    objXMLHTTP.open "
    GET",UnEscape(URL),false
    objXMLHTTP.send()
    If objXMLHTTP.Status = 200 Then
        Set objADOStream = CreateObject("
    ADODB.Stream")
        objADOStream.Open
        objADOStream.Type = 1 'adTypeBinary
        objADOStream.Write objXMLHTTP.ResponseBody
        objADOStream.Position = 0    'Set the stream position to the start
        If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation
        objADOStream.SaveToFile strHDLocation
        objADOStream.Close
        Set objADOStream = Nothing
    End If
    Set objXMLHTTP = Nothing
     
    MsgBox "
    The Download of " & Dblquote(Tab(UBound(Tab))) & " is finished ",64,"The Download of " & Dblquote(Tab(UBound(Tab))) & " is finished "
    Command = "
    Cmd /c start explorer "& Dblquote(strHDLocation) &" "
    Start = Ws.Run(Command,0,False)
     
    Function Dblquote(str)
        Dblquote = chr(34) & str & chr(34)
    End Function 

  2. #2
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: URL encoding problem ?

    I'm not sure about this, but the website probably denied your request because of an invalid user agent.
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 2010
    Location
    http://bbat.forumeiro.com/
    Posts
    86

    Thumbs up [Solved] URL encoding problem ?

    The problem is resolved here in this discussion
    Go, I wish you a Good Downloading and a good mixing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width