Join Free
+ Reply to Thread
Results 1 to 5 of 5
  1. #1

    Get merchants/coupons - PHP Curl Simple

    Simple way to get all merchants via PHP/Curl

    PHP Code:
    $ch curl_init();
    curl_setopt($chCURLOPT_URL"http://api.prosperent.com/api/merchant");
    curl_setopt($chCURLOPT_RETURNTRANSFER1);
    curl_setopt($chCURLOPT_POSTtrue);

    $data = array(
        
    'limit' => '10000',
    );

    curl_setopt($chCURLOPT_POSTFIELDS$data);
    $output curl_exec($ch);
    $info curl_getinfo($ch);
    curl_close($ch);


            
    $return json_decode$output );

    foreach ( 
    $return->data as $trend )
    {
        
    $mer $trend->merchant;
        
    $logo $trend->logoUrl;
        




    Get Coupons for merchant name PHP / Curl

    PHP Code:

    $mername 
    "6pm";
    $apikey "lalalala";

    $ch curl_init();
    curl_setopt($chCURLOPT_URL"http://api.prosperent.com/api/coupon/search");
    curl_setopt($chCURLOPT_RETURNTRANSFER1);
    curl_setopt($chCURLOPT_POSTtrue);
    $ip $_SERVER['REMOTE_ADDR'];
    $data = array(
            
    'api_key' => $apikey
            
    'filterMerchant'   => $mername,
            
    'visitor_ip' => $ip
    );

    curl_setopt($chCURLOPT_POSTFIELDS$data);
    $output curl_exec($ch);
    $info curl_getinfo($ch);
    curl_close($ch);

    //echo($output);
            
    $return json_decode$output );

    foreach ( 
    $return->data as $trend )
    {
        
        
    $cid $trend->couponId;
        
    $affurl $trend->affiliate_url;
        
    $keyword $trend->keyword;
        
    $keywords $trend->keywords;
        
    $description $trend->description;
        
    $catgory $trend->category;
        
    $merchant $trend->merchant;
        
    $coupon $trend->coupon_code;
        
    $restrictions $trend->restrictions;
        
    $startdate $trend->start_date;
        
    $expiration $trend->expiration_date;
        
    $image $trend->image_url;
        
    $city $trend->city;
        
    $state $trend->state;
        
    $promo $trend->promo;
        


  2. #2
    much easier to use the Prosperent_Api.php file they provide you with for everything required

  3. #3
    I had some issue at first so I came up with this, and shared if anyone else has similar

  4. #4
    What kind of issues did you experience? maybe it will help someone else

  5. #5
    Thanks for sharing your code. Terry, good to see you here It's a small world, right?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
coupons | coupons and deals