#1
  1. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    May 2004
    Location
    Boston, MA USA
    Posts
    563
    Rep Power
    51

    cURL in WordPress ?


    I'm not sure this is the best forum but I wasn't sure what was better and I like the PHP community.

    I have a small SaaS business management tool developed in PHP/MySQL. My customers (business managers) can export data from my system to their own websites using a cURL function similar to:
    Code:
    $URL="https://www.mySAASsite.com/products_4_web.php?biz_id=19";
    $ch = curl_init();
    curl_setopt ($ch, CURLOPT_URL, "$URL");
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
    $contents = curl_exec($ch);
    curl_close($ch);
    echo $contents;
    One of my customer's web site is developed in WordPress which I have no experience with. They are not having any luck implementing the cURL function.

    Can anyone give me any advice or point me to a good resource to help?

    Thanks
  2. #2
  3. Impoverished Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,827
    Rep Power
    9646
    Well first you have to understand why it's not working. Having WordPress or not shouldn't make a difference - could it be that they don't have cURL installed?

    Basic troubleshooting steps, here. How does it not work? Are there any error messages? Checked the server error logs?
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2017
    Location
    Lithuania
    Posts
    48
    Rep Power
    46
    I didn't check WP code, but I'm 99.99% sure it would contain one or more curl-based functions itself. I mean, WP doesn't prevent curl from working on the same site where WP is installed.

    We can surely give you a solution (especially when the code is such simple), but we need to know more details. Please let us know what errors you get, what debugging was made, etc. Especially, please indicate how clients run this script. I mean, did they just upload some PHP file with curl code on the same site where WP is installed, or did they make a plugin for WP, so they execute the code inside WP admin dashboard?

IMN logo majestic logo threadwatch logo seochat tools logo