Unix command line CURL equivalent in PHP CURL

kokopeti

New Member
The following snippet is from "http://pdfx.cs.man.ac.uk/usage". This very great tool and it converts scientific papers in pdf to xml. \[code\]curl --data-binary @"/path/to/my.pdf" -H "Content-Type: application/pdf" -L "http://pdfx.cs.man.ac.uk"\[/code\]This code is unix command line code and I want its PHP version. I have tried \[code\]$pdfFile = fopen('jucs_18_05_0623_0649_hasan.pdf', 'r');$fileSize = filesize ('jucs_18_05_0623_0649_hasan.pdf');$url="http://pdfx.cs.man.ac.uk";$ch=curl_init();curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // curl_setopt($ch, CURLOPT_TIMEOUT, 100);curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_PUT, true);curl_setopt($ch, CURLOPT_INFILE, $pdfFile);curl_setopt($ch, CURLOPT_INFILESIZE, $fileSize);curl_setopt($ch, CURLOPT_VERBOSE, true);$fp = fopen("test.xml", "w");curl_setopt($ch, CURLOPT_FILE, $fp);if (! $res = curl_exec($ch)) echo "Error: ".curl_error($ch);else { echo "Success";} curl_close($ch);\[/code\]The problem is the output to the test.xml is the index file html code instead of converted xml version of the provided article. Waiting for your expert opinion...Thanks in advance
 
Back
Top