Results 1 to 13 of 13

 

Thread: Free CJ Webservices Script

  1. #1
    scriptmonkey's Avatar
    Oranges & Lemons

    Status
    Offline
    Join Date
    Jan 2009
    Location
    Worthing
    Posts
    1,607
    Thanks
    112
    Thanked 253 Times in 192 Posts


    Code removed because of hit'n'run
    The trouble with the rat race is that even if you win you're still a rat.
    Time passes. Listen. Time passes. Dylan Thomas
    Ebay Alerts to your inbox

  2. #2
    scriptmonkey's Avatar
    Oranges & Lemons

    Status
    Offline
    Join Date
    Jan 2009
    Location
    Worthing
    Posts
    1,607
    Thanks
    112
    Thanked 253 Times in 192 Posts
    Eep, 300 views, not a single response :scared, I'll keep my code to myself I think.
    The trouble with the rat race is that even if you win you're still a rat.
    Time passes. Listen. Time passes. Dylan Thomas
    Ebay Alerts to your inbox

  3. #3
    Registered User

    Status
    Offline
    Join Date
    Apr 2006
    Location
    Birmingham
    Posts
    125
    Thanks
    7
    Thanked 3 Times in 3 Posts
    HI script Id be interested in the script. Im just looking for a niche at the moment. :tup
    Click Them and they Might Come

  4. #4
    Registered User

    Status
    Offline
    Join Date
    Jun 2008
    Posts
    664
    Thanks
    3
    Thanked 37 Times in 30 Posts
    No need to get touchy about it ? don't know what the script is, don't know what you're on about, don't therefore know why you posted in the first place.. ?

  5. #5
    scriptmonkey's Avatar
    Oranges & Lemons

    Status
    Offline
    Join Date
    Jan 2009
    Location
    Worthing
    Posts
    1,607
    Thanks
    112
    Thanked 253 Times in 192 Posts
    Quote Originally Posted by Lawcom View Post
    No need to get touchy about it ?
    You're right of course :blush, I posted the code to a script that interacts with cj's webservice and displays product from their extensive database in php pages. It works really well, and, I was a little grouchy after thinking that I'd supplied lurkers with valuable code, with not a single comment or thanks, so I removed it.

    Panties are no longer in a bunch :tup

    Code is available on request
    The trouble with the rat race is that even if you win you're still a rat.
    Time passes. Listen. Time passes. Dylan Thomas
    Ebay Alerts to your inbox

  6. #6
    Daniel Powel's Avatar
    Member

    Status
    Offline
    Join Date
    Jul 2007
    Posts
    345
    Thanks
    3
    Thanked 27 Times in 21 Posts
    Hi Scriptmonkey,

    I just saw your post. Sorry for the delay in our response.

    Thank you for taking an interest in our Webservices and creating a script. Although we've not tested the functionality yet, we love the fact that developers are interacting with Webservices.

    I would like to talk to you a bit more about your efforts and how we can open them up to the community. When you get a chance, drop me a line to talk further.

    Thank you,

    Daniel Powel
    dpowel@cj.com
    0208 785 5825

  7. #7
    Registered User

    Status
    Offline
    Join Date
    May 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi, Scriptmonkey, I am a new member here. We are a Chinese team targeting to online promotion. Could you please share the script with me? Really Thank you for your nice work.

    Quote Originally Posted by scriptmonkey View Post
    Code removed because of hit'n'run

  8. #8
    scriptmonkey's Avatar
    Oranges & Lemons

    Status
    Offline
    Join Date
    Jan 2009
    Location
    Worthing
    Posts
    1,607
    Thanks
    112
    Thanked 253 Times in 192 Posts
    Save the following as a php page and call it with as many or as few of the variables as you want.

    Coming soon, CJ Wordpress plugin

    PHP Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style type="text/css">
    <!--
    body,td,th {
        font-family: Verdana, Arial, Helvetica, sans-serif;
        font-size: 11px;
    }
    .centralproducts {
    width:310px;
    margin: 5px;
    padding:2px;
    display:inline-block;
    float:left;
    min-height:200px;
    height:200px;
    overflow:hidden;
    border:1px solid #000033;
    background-color:#FFFFFF
    }
    .centralproducts img{
    border:none;
    float:left;
    margin:5px;
    }

    -->
    </style>
    </head>

    <body>
    <?php

    ini_set
    ("soap.wsdl_cache_enabled""1");
    //Variables
    // keywords = 'q' defaults to white ( whitespace must be encoded as + and + must be encoded as %2B )
    // currency = 'c' defaults to GBP
    // number of results = 'n' defaults to 10
    // advertisers = 'a' defaults to all joined
    // startat = 's' defaults to 0
    //sortBy = 'sb' defaults to price valid values are 'price | name | advertiserName | advertiserId | manufacturerName'
    //sortorder = 'so' defaults to ascending valid values 'asc | desc'

    $developerKey "YOUR DEVELOPER KEY";
    $websiteId "YOUR CJ SITE ID";
    $keywords "white";
    if (isset(
    $_GET['q'])) {
      
    $keywords $_GET['q'];
    }
    $number "10";
    if (isset(
    $_GET['n'])) {
      
    $number $_GET['n'];
    }
    $advertiser "joined";
    if (isset(
    $_GET['a'])) {
      
    $advertiser $_GET['a'];
    }
    $startAt "0";
    if (isset(
    $_GET['s'])) {
      
    $startAt $_GET['s'];
    }
    $currency "GBP";
    if (isset(
    $_GET['c'])) {
      
    $currency $_GET['c'];
    }
    $sortBy "price";
    if (isset(
    $_GET['sb'])) {
      
    $sortBy $_GET['sb'];
    }
    $sortorder "asc";
    if (isset(
    $_GET['so'])) {
      
    $sortorder $_GET['so'];
    }

     

    $client = new SoapClient("https://product.api.cj.com/wsdl/version2/productSearchServiceV2.wsdl", array('trace'=> true));
    $results $client->search(array("developerKey" => $developerKey,
    "websiteId" => $websiteId,
    "startAt" => $startAt,
    "maxResults" => $number,
    "keywords" => $keywords,
    "currency" => $currency,
    "lowPrice" => '0.5',
    "sortBy" => $sortBy,
    "sortOrder" => $sortorder,
    "advertiserIds" => $advertiser));


    foreach(
    $results->out->products->Product as $details){
    $image $details->imageUrl;
    $id $details->sku;
    $name $details->name;
    $merchantlink $details->buyUrl;
    $price $details->price;
    $description $details->description;
    $advertiserName $details->advertiserName;
    echo 
    "<div  class=\"centralproducts\"/><a href=".$merchantlink." title=\"".$name."\"><img src=\"".$image."\" width=\"100\" alt=\"".$name."\" /></a><b>".$advertiserName."</b><br/><br/><b>".str_replace('&apos;','\'',$name)."</b><br/><br/>".substr($description,0,400)."...<br/><font color=\"red\">&pound;".$price."</font></div>";

    }
    $thecount $results->out->totalResults;


    //echo "<div style=\"clear:both;\"/><pre>";
    //print_r($results);
    //echo "</pre>";

    ?>
    </body>
    </html>
    The trouble with the rat race is that even if you win you're still a rat.
    Time passes. Listen. Time passes. Dylan Thomas
    Ebay Alerts to your inbox

  9. The Following 2 Users Say Thank You to scriptmonkey For This Useful Post:

    Azam.net (19-06-09), pinman (19-06-09)

  10. #9
    Registered User

    Status
    Offline
    Join Date
    Nov 2007
    Location
    Swansea
    Posts
    71
    Thanks
    8
    Thanked 4 Times in 4 Posts
    Hi Scriptmonkey - thanks for a great cool script (yet again!) :tup

    Just thought I'd give you some feedback which will hopefully help everyone....

    Here's the default CJ script in action - which works fine and dandy (apart from the price display).

    However, if I change the keywords variable to "Lego" I get this output and if I change the keywords variable to "dinosaur" I get this output :scared

    I suspect they latter results/errors are to do with the lack of merchants I've signed up to which offer such "products" or not as the case may be

    Please don't think I'm being negative about your script - far from it - I'm just hoping my feedback will help iron out any creases

  11. #10
    scriptmonkey's Avatar
    Oranges & Lemons

    Status
    Offline
    Join Date
    Jan 2009
    Location
    Worthing
    Posts
    1,607
    Thanks
    112
    Thanked 253 Times in 192 Posts
    Hi D, and thanks

    Oddly enough I get the same errors, but, I'm not signed up to many merchants with the developer id that I use. I don't think for instance that argos products are filtering through into this system

    I've kind of abandoned that script now, as cj's webservice isn't as reliable as it needs to be for me to create anything around it.

    BTW you can just use the querystring like so

    Commission Junction Script by scriptmonkey

    etc. without having to change the code in the page

    as for the price thing, it just needs a number_format on it like so

    replace
    &pound;".$price."
    with
    &pound;".number_format($price,2,'.',',')."
    The trouble with the rat race is that even if you win you're still a rat.
    Time passes. Listen. Time passes. Dylan Thomas
    Ebay Alerts to your inbox

  12. #11
    Registered User

    Status
    Offline
    Join Date
    Nov 2007
    Location
    Swansea
    Posts
    71
    Thanks
    8
    Thanked 4 Times in 4 Posts
    Thanks for the tips and extra code scriptmonkey - worked a treat :tup

    Having tested things further, the old "Warning: Invalid argument supplied for foreach()" error seems to crop up when you use a keyword that doesn't exist in the CJ webservice :td

    It's a shame that the webservice appears to be so flaky really

    Still, its been a useful learning exercise for me

  13. #12
    scriptmonkey's Avatar
    Oranges & Lemons

    Status
    Offline
    Join Date
    Jan 2009
    Location
    Worthing
    Posts
    1,607
    Thanks
    112
    Thanked 253 Times in 192 Posts
    It was more of an example code than a production thing, but, that error is basically where the for each loop is trying to run through an array that is empty.

    I think that the webservice was built with data retrieval into a database uppermost in the developers mind, so, for using in a live environment it's not really appropriate, unless of course the results were cached.

    There's always the possibility of it being a GIGO error, sometimes my coding isn't as shiny as it should be :scared

    I'll have another look at the documentation tonight or tomorrow, and see if theres any further parameters that could be sent in the request to get around that error, or more likely, write a proper error handler for it :blush and a caching routine.
    The trouble with the rat race is that even if you win you're still a rat.
    Time passes. Listen. Time passes. Dylan Thomas
    Ebay Alerts to your inbox

  14. The Following User Says Thank You to scriptmonkey For This Useful Post:

    Azam.net (19-06-09)

  15. #13
    Registered User

    Status
    Offline
    Join Date
    Jan 2009
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I usually do CJ WS in this way. I run a script which query cj ws by keyword --> store the data in xml file --> convert it to mysql --> use another script to call the data in wordpress. may be you don't need to save the data in xml file, you can just save them directly in mysql, but i got some reason to do it in that way.

    If it do it in this way, I think it's more reliable than querying the cj ws directly. :tup



Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. CJ Webservices PHP script
    By scriptmonkey in forum Programming
    Replies: 3
    Last Post: 07-09-09, 12:12 PM
  2. Free icodes webservices accounts for blog reviews
    By Leeky in forum Media Coverage & PR Strategy
    Replies: 47
    Last Post: 17-11-08, 11:22 PM
  3. Free Kelkoo affiliate script
    By Leeky in forum Programming
    Replies: 0
    Last Post: 30-12-06, 01:42 PM
  4. Free fonetasticmobile script.
    By Leeky in forum Programming
    Replies: 2
    Last Post: 18-11-06, 10:24 PM
  5. Amazon Webservices Script needed
    By scifind in forum Programming
    Replies: 3
    Last Post: 09-06-05, 04:58 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
To Top

Content Relevant URLs by vBSEO 3.5.0 RC2