保存Web请求中收到的PDF文件

时间:2015-10-30 07:00:34

标签: php laravel http-post

我正在使用一个服务,它按照以下格式在指定的URL上点击我们的服务器..我应该如何在php中保存这个文件

{{#each model.myApi as |myApi|}}
{{#if someCondition}}
{{my-radiobutton name='myName_{{myApi.someId}}' value='someAction_{{myApi.someId}}' selection=this.selectedRadio {{action 'actionClicked'}}}}
{{else}}
{{my-radiobutton name='myName_{{myApi.someId}}' value='someAction_{{myApi.someId}}' selection=this.selectedRadio {{action 'actionClicked'}}}}
{{/if}}
{{/each}}

1 个答案:

答案 0 :(得分:0)

您可以使用file_put_contents()

<?php
$yourfile = "PATH/TO/YOUR/STREAM.php";
$newfile = "PATH/WHERE/YOU/WANT/NEW/FILE/newfile.pdf";
if(file_put_contents($yourfile, $newfile)){
  echo 'successfull new file created';
}else{
echo 'Something failded it. Check your path';
}
?>