PhantomJS - 从cmd w / Curl发送POST无法正常工作

时间:2014-02-22 09:33:41

标签: highcharts phantomjs

当我尝试发布您的文档http://www.highcharts.com/docs/export-module/render-charts-serverside中的示例代码时出现错误。

Here is the screencast when I tried to start PhantomJS through commandline.
http://www.screencast.com/t/rDcPYZOi1

Here is the error when I tried to post through commandline using curl.
http://www.screencast.com/t/GnYoMBsUqXfR

Here are the other details that might be probably helpful for investigating what is cause of the error.
Files that were all in one location.
http://www.screencast.com/t/VJ7aK6igSTha

I have also tried to run this code through commandline **"phantomjs highcharts-convert.js -infile options.json -outfile chartTest.png -scale 2.5 -width 300 "** and it works and rendered a graph.
http://www.screencast.com/t/G3U2QatAjgU

Just let me know if you need any other details to solve the issue.

1 个答案:

答案 0 :(得分:1)

好的,问题在于额外的空格并在CLI中使用'

为Windows CURL工作JSON示例:

curl -H "Content-Type: application/json" -X POST -d "{\"infile\":\"{series:[{data:[29.9,71.5,106.4]}]}\"}" 127.0.0.1:8080