2011-08-23 53 views
0

這是我的腳本,但我在從URL獲取響應時遇到問題。在AppleScript上捲曲

if newChromeValue contains "http://" then 
     set URLChromerequest to "curl --url http://0.0.0.0:54321/cat?body=" & myBodyEnc & "&url=" & ¬ 
      newChromeValue & ¬ 
      "&title=" & ¬ 
      pgTitlEnc & ¬ 
      "&keywords=" & ¬ 
      mykeywordEnc & ¬ 
      "&description=" & ¬ 
      myDescriptionEnc & ¬ 
      "&type=body&reqtype=main/" 

    else 
     set URLChromerequest to "curl --url http://0.0.0.0:54321/cat?body=" & myBodyEnc & "&url=http://" & ¬ 
      newChromeValue & ¬ 
      "&title=" & ¬ 
      pgTitlEnc & ¬ 
      "&keywords=" & ¬ 
      mykeywordEnc & ¬ 
      "&description=" & ¬ 
      myDescriptionEnc & ¬ 
      "&type=body&reqtype=main/" 

    end if 



    set URLChromeResponse to do shell script URLChromerequest 
    return URLChromeResponse 

當我運行這個腳本時,它顯示只有第一個參數通過服務器發送,它是'body'。其他人看來不過是失蹤......

,如果我回到了「URLChromerequest」我可以看到該URL形式因此,如果我把它粘貼到網頁瀏覽器,它完美..

可能是什麼問題?

回答

1

這可能有助於引述使用quoted form of的網址:

if newChromeValue does not start with "http://" then 
    set newChromeValue to "http://" & newChromeValue 
end 

set URLChromerequest to "curl --url " & quoted form of ¬ 
    ("http://0.0.0.0:54321/cat?body=" & myBodyEnc & ¬ 
    "&url=" & newChromeValue & ¬ 
    "&title=" & pgTitlEnc & ¬ 
    "&keywords=" & mykeywordEnc & ¬ 
    "&description=" & myDescriptionEnc & ¬ 
    "&type=body" & ¬ 
    "&reqtype=main/") 

set URLChromeResponse to do shell script URLChromerequest 

不要」肯定知道,雖然,但它似乎URL是由外殼分裂