title: Convert command line cURL to PHP cURL
body: <p>I've never done any curl before so am in need of some help. I've tried to work this out from examples but cannot get my head around it!</p>
  
  <p>I have a curl command that I can successfully run from a linux(ubuntu) command line that puts a file to a wiki through an api.</p>
  
  <p>I would need to incorporate this curl command in a PHP script I'm building.</p>
  
  <p>How can I translate this curl command so that it works in a PHP script?</p>
  
  <pre><code>curl -b cookie.txt -X PUT \
       --data-binary "@test.png" \
       -H "Content-Type: image/png" \    
       "http://hostname/@api/deki/pages/=TestPage/files/=test.png" \
       -0
  </code></pre>
  
  <p>cookie.txt contains the authentication but I don't have a problem putting this in clear text in the script as this will be run by me only.</p>
  
  <p>@test.png must be a variable such as $filename</p>
  
  <p><a href="http://hostname/@api/deki/pages/=TestPage/files/=" rel="noreferrer">http://hostname/@api/deki/pages/=TestPage/files/=</a> must be a variable such as $pageurl</p>
  
  <p>Thanks for any help.</p>