2011-11-28 51 views
0

我正在上传URL(http://www.endomondo.com)中的文件,但我不能。我可以登录网址,但无法上传文件。请问你能帮帮我吗?非常感谢并为我的英语感到难过。我的代码是:上传文件(gpx)与卷曲

curl -Lc trackcookie.txt http://www.endomondo.com 
curl -Lb trackcookie.txt -d '[email protected]&password=PASSWORD' 'https://www.endomondo.com/access?wicket:interface=:1:pageContainer:lowerMain:lowerMainContent:signInPanel:signInForm::IFormSubmitListener::' 
curl -v -F filedata=pistaSubir.gpx 'http://www.endomondo.com/?wicket:interface=:4:importPanel:wizardStepPanel:uploadForm:uploadSumbit::IActivePageBehaviorListener:0:-1&wicket:ignoreIfNotActive=true&wicket:ajax=true' 
* About to connect() to www.endomondo.com port 80 (#0) 
* Trying 176.34.249.204... connected 
* Connected to www.endomondo.com (176.34.249.204) port 80 (#0) 
> POST /?wicket:interface=:4:importPanel:wizardStepPanel:uploadForm:uploadSumbit::IActivePageBehaviorListener:0:-1&wicket:ignoreIfNotActive=true&wicket:ajax=true HTTP/1.1 
> User-Agent: curl/7.19.7 (i486-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15 
> Host: www.endomondo.com 
> Accept: */* 
> Content-Length: 157 
> Expect: 100-continue 
> Content-Type: multipart/form-data; boundary=----------------------------7b8c4aecfb15 
> 
< HTTP/1.1 100 Continue 
< HTTP/1.1 200 OK 
< Ajax-Location: login 
< Cache-Control: no-cache, must-revalidate 
< Content-Type: text/xml 
< Date: Mon, 28 Nov 2011 16:25:34 GMT 
< Expires: Mon, 26 Jul 1997 05:00:00 GMT 
< P3P: CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT" 
< Pragma: no-cache 
< Server: Apache-Coyote/1.1 
< Set-Cookie: JSESSIONID=5760211D1D4B635A02E9D69677DA8B73; Path=/ 
< Set-Cookie: AWSELB=596D5F61100CE5ABA8843B846DBDD12FB4223A2CC68ACE6074E3879F3B06AB55F6DA7DE246A1B11DF015B7EDB45CF82FE78510C4A5506ED5E5BDAC87E60C799B569AEC08B252AE864ABBF774F8FF8209C889D10CCA;PATH=/ 
< X-UA-Compatible: IE=9 
< Content-Length: 69 
< Connection: keep-alive 

编辑 的活HTTP头:

http://www.endomondo.com/?wicket:interface=:2:importPanel:wizardStepPanel:uploadForm:uploadSumbit::IActivePageBehaviorListener:0:-1&wicket:ignoreIfNotActive=true&wicket:ajax=true 

POST /?wicket:interface=:2:importPanel:wizardStepPanel:uploadForm:uploadSumbit::IActivePageBehaviorListener:0:-1&wicket:ignoreIfNotActive=true&wicket:ajax=true HTTP/1.1 
Host: www.endomondo.com 
User-Agent: Mozilla/5.0 (X11; U; Linux i686; es-ES; rv:1.9.2.3) Gecko/20100423 Ubuntu/10.04 (lucid) Firefox/3.6.3 
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 
Accept-Language: es-es,es;q=0.8,en-us;q=0.5,en;q=0.3 
Accept-Encoding: gzip,deflate 
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 
Keep-Alive: 115 
Connection: keep-alive 
Referer: http://www.endomondo.com/?wicket:interface=:2:::: 
Cookie: __utma=162144232.314244061.1322224370.1322495708.1322558556.5; __utmz=162144232.1322224370.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); EndomondoApplication_USER=username%40gmail.com; EndomondoApplication_AUTH=gy49RxPy-Y*w8HJnWKXN90BPgWw; JSESSIONID=290127FBBDF7991EE5F8A4EEBE01292E; AWSELB=596D5F61100CE5ABA8843B846DBDD12FB4223A2CC65233E77DF36EB7F1D876257A06A22E14AD397261D99E802164D454611D470D0F989FFAF7A29F03F689F08EA8B56FBD2C05FBE9A6DA21746C8543605F8C9E21C7; __utmb=162144232.3.10.1322558556; __utmc=162144232 
Content-Type: multipart/form-data; boundary=---------------------------75208478120228366171295351650 
Content-Length: 54514 
-----------------------------75208478120228366171295351650 
Content-Disposition: form-data; name="idb0_hf_0" 


-----------------------------75208478120228366171295351650 
Content-Disposition: form-data; name="uploadFile"; filename="pistaSubir.gpx" 
Content-Type: application/octet-stream 
<?xml version="1.0"?> 
<gpx creator="http://sportstracklive.com" version="1.0" xmlns="http://www.topografix.com/GPX/1/1" xmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"><metadata><link lon="-3.644933701"><ele>715</ele><cadence>76</cadence><extensions><gpxtpx:TrackPointExtension><gpxtpx:hr>175</gpxtpx:hr></gpxtpx:TrackPointExtension></extensions><time>2011-11-23T18:26:51Z</time></trkpt></trkseg></trk></gpx> 
-----------------------------75208478120228366171295351650 
Content-Disposition: form-data; name="uploadSumbit" 

1 
-----------------------------75208478120228366171295351650-- 

HTTP/1.1 200 OK 
Cache-Control: no-cache, must-revalidate 
Content-Type: text/xml;charset=UTF-8 
Date: Tue, 29 Nov 2011 09:23:27 GMT 
Expires: Mon, 26 Jul 1997 05:00:00 GMT 
P3P: CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT" 
Pragma: no-cache 
Server: Apache-Coyote/1.1 
X-UA-Compatible: IE=9 
Content-Length: 4240 
Connection: keep-alive 

回答

0

第三curl不使用的cookies文件。

+0

如果我这样做:curl -v -Lb trackcookie.txt -F filedata = pistaSubir.gpx'http://www.endomondo.com/?wicket:interface=:4:importPanel:wizardStepPanel:uploadForm:uploadSumbit :: IActivePageBehaviorListener:0:-1&便门:ignoreIfNotActive =真便门:AJAX =真”。 Doesn'works – user650034

+0

@flesk:你知道我能做到吗?谢谢 – user650034

+0

然后显示http dump。此外,您可以通过浏览器执行请求,并使用工具显示http流量,然后将其与curl进行比较。 – kan