Tips and Tricks HQ Support Portal › Forums › WP PDF Stamper › Null Value on return from CURL Post
Tagged: purchased
- This topic has 4 replies, 3 voices, and was last updated 13 years, 5 months ago by amin007.
-
AuthorPosts
-
June 17, 2011 at 5:01 pm #3614djmosoulMember
I used this code here: http://www.tipsandtricks-hq.com/wp-pdf-stamper/wp-content/uploads/2010/06/pdf-stamper-integration-sample-php-code1.txt
I have 3 PDF downloads that I wished to use with this plugin, and 2 out of the 3 are working perfectly.
The one that isn’t working perfectly is being created in the directory with the proper stamp on the PDF, but the CURL POST to create the PDF is returning a blank value.
The PDF in question is: http://breakingintowallstreet.com/biws/pdf_files/IBD-Questions-Answers.pdf
Here is a link to the stamped PDF: http://breakingintowallstreet.com/biws/wp-content/plugins/wp-pdf-stamper/stamped-files/IBD-Questions-Answers_4dfa59769f6e7.pdf
I could probably troubleshoot this myself, but the plugin code is encoded.
Thanks for your help.
Also, here is the function that is returning a blank value for the variable $returnValue:
if(!function_exists(‘anatta_hotlinker_stamp_pdf’)):
function anatta_hotlinker_stamp_pdf($fileURL=null){
global $current_user;
if(is_null($fileURL))
return false;
/*** Mandatory data ***/
// Post URL (Get this value from the Integration Help menu of this plugin)
$postURL = get_bloginfo(‘url’).”/wp-content/plugins/wp-pdf-stamper/api/stamp_api.php”;
// The Secret key (Get this value from the settings menu of this plugin)
$secretKey = “fwoieVNDSVONweoifjwo”;
/*** Optional Data ***/
//Customers Name
$customerName = $current_user->first_name.” “.$current_user->last_name;
//Customer Email address
$customerEmail = $current_user->user_email;
//Customer’s Address
$customerAddress = $current_user->address1.”, “.$current_user->city.”, “.$current_user->state.” – “.$current_user->zip;
// prepare the data
$data = array ();
$data = $secretKey;
$data = $fileURL;
$data = $customerName;
$data = $customerEmail;
$data = $customerAddress;
// send data to post URL
$ch = curl_init ($postURL);
curl_setopt ($ch, CURLOPT_POST, true);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
$returnValue = curl_exec ($ch);
// Process the return values
list ($status, $value) = explode (“n”, $returnValue);
if(strpos($status,”Success!”) !== false){
return trim($value);
}
return false;
}
endif;
June 18, 2011 at 1:00 am #33519amin007ParticipantDid you try doing a manual stamping with this PDF File?
http://breakingintowallstreet.com/biws/pdf_files/IBD-Questions-Answers.pdf
If you haven’t please do that and let me know how the manual stamping goes.
June 20, 2011 at 7:07 pm #33520djmosoulMemberMaybe I don’t understand what a manual stamp is, but I am calling the API file, so I would imagine what I described above is a manual stamp.
The CURL post, which I believe is a manual stamp, is returning a blank value.
June 21, 2011 at 12:19 am #33521wpCommerceModeratorJune 21, 2011 at 12:27 am #33522amin007ParticipantIn your case you were able to successfully stamp a file using the code above which gives me indication that the code is fine. The problem could be with the PDF file itself. The manual stamping has more error condition checking so it might reveal the actual problem with the PDF file (for example: if the PDF file is locked then it won’t be able to stamp it).
-
AuthorPosts
- You must be logged in to reply to this topic.