Skip to content

Instantly share code, notes, and snippets.

@manojchowrasiya
Created February 9, 2017 07:19
Show Gist options
  • Save manojchowrasiya/de62de8dee550ae6fa9f775492aeee10 to your computer and use it in GitHub Desktop.
Save manojchowrasiya/de62de8dee550ae6fa9f775492aeee10 to your computer and use it in GitHub Desktop.
$url  = '10.155.33.67:8081/ws-common/service/attachment/download?attachmentType=BL&customerId=0000001418&deliveryId=1804095213&fileExt=pdf&signature=MmI1NTg5MTIxMzhlY2U0ZDI1MTI3ZjZhODkwZWU2OTllNjBmYjU1Yg==';
$path = "css/1234567.pdf";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
curl_close($ch);
if(file_exists($path)){
  echo "already exits";
}else{
  
  echo "success";
}
$result = file_put_contents($path, $data);
if(!$result){
  echo "error";
}else{
  echo "success";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment