2011-08-23 3 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 

이 스크립트를 실행하면 첫 번째 매개 변수 만 '본문'인 서버를 통해 전송됩니다. 다른 사람은 내가 'URLChromerequest'를 반환하면 내가 .. URL이 양식을 따라 내가이 웹 브라우저에 붙여 경우, 그것은 완벽하게 작동하는지 볼 수 있습니다, 그러나 ...

누락 것으로 보인다

문제가되는 것은 무엇입니까?

답변

1

그것은 quoted form of를 사용하여 URL을 인용하는 데 도움이 될 수 있습니다

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이 쉘에 의해 분할되고있는 것으로 보인다

관련 문제