Tips and Tricks HQ Support

Support site for Tips and Tricks HQ premium products

  • Home
  • Contact Us
  • Documentation
  • Forum Home
    • Forum
    • Forum Search
    • Forum Login
    • Forum Registration

HTTP POST Method Won't Work

by

Tips and Tricks HQ Support Portal › Forums › WP PDF Stamper › HTTP POST Method Won't Work

Tagged: HTTP Post, WP PDF Stamper

  • This topic has 7 replies, 2 voices, and was last updated 12 years, 5 months ago by thpwebteam.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • September 30, 2010 at 4:18 pm #1945
    thpwebteam
    Member

    Greetings,

    I was able to get the “Manual Stamping” to work as well as the HTTP GET method. However, I have not been successfully able to get the HTTP Post method to work even though I’m using the same parameters as the GET method.

    I don’t get any errors from the sample HTTP Post sample code. All it returns is:

    “An error occured while trying to stamp the file! Error details: “

    Any ideas?

    October 1, 2010 at 1:14 am #24936
    amin007
    Participant

    Maybe some mandatory parameter is missing. Can you please tell how you are trying to use it? Please provide the code you are using so I can have a look.

    What is your PDF stamper version?

    October 1, 2010 at 1:21 pm #24937
    thpwebteam
    Member

    I basically took the code below, put it in a php file, placed the file in the root, and ran it from the browser.

    <?
    /*** Mandatory data ***/
    // Post URL (Get this value from the Integration Help menu of this plugin)
    $postURL = "http://www.webdev4.com/wp-content/plugins/wp-pdf-stamp/api/stamp_api.php";
    // The Secret key (Get this value from the settings menu of this plugin)
    $secretKey = "4ca4929b783ec5.15678014"; //not actual for security purposes
    //The source file URL (The file that you want to stamp)
    $fileURL = "http://www.webdev4.com/wp-content/uploads/fw4.pdf";

    /*** Optional Data ***/
    //Customers Name
    $customerName = "John Doe";
    //Customer Email address
    $customerEmail = "john.doe@gmail.com";
    //Customer's Address
    $customerAddress = "123 Some Street, San Jose, CA - 95130, U.S.A.";

    // prepare the data
    $data = array ();
    $data['secret_key'] = $secretKey;
    $data['source_file'] = $fileURL;
    $data['customer_name'] = $customerName;
    $data['customer_email'] = $customerEmail;
    $data['customer_address'] = $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)
    {
    $file_url = trim($value);
    echo "The URL of the stamped file is: ".$file_url;
    }
    else
    {
    echo "An error occured while trying to stamp the file! Error details: ".$value;
    }
    ?>

    October 2, 2010 at 2:28 am #24938
    amin007
    Participant

    Thanks for sharing the code… I see the issue now :)

    The POST URL is incorrect (it’s giving a 404)

    $postURL = "http://www.webdev4.com/wp-content/plugins/wp-pdf-stamp/api/stamp_api.php";

    If you read the comment above that line you will see that it tells you to get this value from the “Integration Help” menu of this plugin. So go ahead and do that and let me know how it goes.

    October 4, 2010 at 4:38 pm #24939
    thpwebteam
    Member

    The URL that I used is from the Integration Menu. See screenshot:

    http://www.tyndale.com/external_parties/pics/tipsandtricks_techsupport/integration_help.jpg

    I also checked that file on the web-server and it is correct.

    If you try to type in the URL you will get a 404. The domain is setup internally on our development web server.

    October 4, 2010 at 4:43 pm #24940
    thpwebteam
    Member

    Also, note that if I use the GET request it works. So something like this works:

    http://www.webdev4.com/wp-content/plugins/wp-pdf-stamper/api/stamp_api.php?secret_key=4ca4929b783ec5.XXXXXXXX&source_file=http://www.webdev4.com/wp-content/uploads/fw4.pdf&customer_name=jon doe&customer_email=jon.doe@gmail.com&customer_address=123 Some Street, San Jose, CA – 95130, U.S.A

    Post is failing, no PDF is being stamped and I’m not getting any errors.

    October 5, 2010 at 2:16 am #24941
    amin007
    Participant

    Sorry, I should have been more specific. If you look at the screenshot again you will see the URL actually has the following:

    wp-pdf-stamper

    Not “wp-pdf-stamp” which has been used in the code. See the “er” at the end of the word? That’s making the URL a non-existent URL.

    Let me know if that helps.

    October 5, 2010 at 3:43 pm #24942
    thpwebteam
    Member

    Brilliant! I’m not even sure how I missed something like that! Thank you so much!

  • Author
    Posts
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.
Log In

Forum Related

  • Forum Home
  • Forum Search
  • Forum Login

Support Related Forms

  • Contact Us
  • Customer Support
  • Request a Plugin Update
  • Request Fresh Download Links

Useful Links

  • Plugin Upgrade Instructions
  • WP eStore Documentation
  • WP eMember Documentation
  • WP Affiliate Platform Documentation
  • WP PDF Stamper Documentation
  • WP Photo Seller Documentation
  • Tips and Tricks HQ Home Page
  • Our Projects

Quick Setup Video Tutorials

  • WP eStore Video Tutorial
  • WP eMember Video Tutorial
  • WP Affiliate Platform Video Tutorial
  • Lightbox Ultimate Video Tutorial
  • WP Photo Seller Video Tutorial

Our Other Plugins

  • WP Express Checkout
  • Stripe Payments Plugin
  • Simple Shopping Cart Plugin
  • Simple Download Monitor

Copyright © 2023 | Tips and Tricks HQ