This is an archived forum post. The information may be outdated. Contact us if you have any questions.

PHP curl REST problem

hudony wrote on 2011-01-07:
Hi,

I am using CURL PHP's library (not yours) to create pdf using full REST. I succedded using curl -F ..... from the command line but when using php's curl functions, all created pdf keep telling my that I am using GET instead of POST but within my code, I am explicitly setting the request type as POST :

curl_setopt($hcurl, CURLOPT_POST, 1);


Any idea why the api is still considering this as a GET request?

Thank you,
support wrote on 2011-01-07:
Hi,

it seems that you are calling the API correctly and that a PDF is created, but you are converting http://pdfcrowd.com/api/pdf/convert/uri/ to PDF.

i.e. you set something like this

// ...
$fields['src'] = 'http://pdfcrowd.com/api/pdf/convert/uri/'
curl_setopt($c, CURLOPT_POSTFIELDS, $fields);


Try to change the src field to a page you want to convert, e.g.

$fields['src'] = 'http://bbc.co.uk'


Does this help?
hudony wrote on 2011-01-07:
Oh, I'm feeling ashamed. You are so right. I was passing the pdfcrowd api url to my method instead of the target url to convert to pdf.

Now, with the correct parameter, it is working fine.

Thank you!
support wrote on 2011-01-07:
We are glad it works for you.

It seems there are no tokens left in your account. Let us know if you need more for trying out the API?