www.enkognedo.com

  • Increase font size
  • Default font size
  • Decrease font size
Home programming PHP cURL and GoldenCan

cURL and GoldenCan

E-mail Print PDF
User Rating: / 3
PoorBest 

GoldenCan provides a nice way to make commissions through Affiliate Marketing.  Basically, GoldenCan provides a product feed that is formated for pagination, product searches, and product information.  One could use this feed to insert into a website dedicated to Affiliate Marketing or maybe one where it is content relevant.  Depending on the web host, there may or may not be "out of the box" success with GoldenCan's code.

I use GoldenCan's PHP code to embed my feeds, since it is search engine friendly - "spiderable", in other words.  Using Javascript might appear cleaner and will definitely take some of the weight off of the server's CPU, but does nothing for search indexing and folks, it is all about having your site show up in the search engines' indexes.  No indexing and no advertising = zero visitors (unless they happen along randomly).

OK.  A typical PHP code block from GoldenCan appears as follows:

<?php
// standard GoldenCan method
$SID="YOUR_SID";
$IPAddress = urlencode($_SERVER['REMOTE_ADDR']);
$UserAgent = urlencode($_SERVER['HTTP_USER_AGENT']);
$Host=urlencode($_SERVER['HTTP_HOST']);
$PageURL=urlencode($_SERVER['SCRIPT_NAME'].'?'.$_SERVER['QUERY_STRING']);
$URL="http://si.goldencan.com/GetData.aspx?ver=2.0&amp;SID=".$SID;
$URL=$URL.'&amp;Host='.$Host;
$URL = $URL.'&amp;PageURL='.$PageURL;
$URL = $URL.'&amp;IPAddress='.$IPAddress;
$URL = $URL.'&amp;UserAgent='.$UserAgent;
include($URL);
?>

Workaround Option 1

The above block may or may not work.  It will not work if the web host has "allow_url_fopen = Off" or "allow_url_include = Off" set in the php.ini file.  A quick workaround to these two settings is to simply create a php.ini file that will reside in the root folder of the site - that is not to say in the root folder of all your sites, i.e. if your site sits at /sites/joomla/site1/, then php.ini needs to be placed under /sites/joomla/site1/[here].  I wrote about this solution a good while back and it can be found [here].

*IF* you have no control over these files and/or adding per folder directives by inserting a php.ini file as mentioned above, then your host will need to do it (if they will) or you are out of luck with this option.

Workaround Option 2

Use PHP's cURL library.  If your host does not support the cURL library, I would seriously recommend finding a better host.  Assuming they do, then use the following code which will *NOT* require a php.ini directive:

<?php
// GoldenCan cURL method
$SID="YOUR_SID"; // grab this from the PHP that GoldenCan provides
$Host=urlencode($_SERVER['HTTP_HOST']); // do not need to change anything here
$URL = "http://si.goldencan.com/GetData.aspx?ver=2.0&amp;SID=".$SID; // this is standard, no need to change anything
$PageURL = urlencode($_SERVER['SCRIPT_NAME'].'?'.$_SERVER['QUERY_STRING']); // do not change
$IPAddress = urlencode($_SERVER['REMOTE_ADDR']); // do not change
$UserAgent = urlencode($_SERVER['HTTP_USER_AGENT']); // do not change
$Host=urlencode($_SERVER['HTTP_HOST']); // do not change
$URL=$URL.'&amp;PageURL='.$PageURL.'&amp;Host='.$Host.'&amp;IPAddress='.$IPAddress.'&amp;UserAgent='.$UserAgent;
$ch = curl_init(); // initialize the cURL
curl_setopt($ch, CURLOPT_URL, "$URL"); // set URL and other appropriate options
curl_setopt($ch, CURLOPT_HEADER, false); // do or do not return the header, usually false; otherwise returns the header to the browser
curl_exec($ch); // grab URL and pass it to the browser
curl_close($ch); // close cURL resource, and free up system resources
?>

Hopefully, one of the above workarounds will work for you.  If no error is given and the content is simply blank, you probably cannot support that method.  If there is an error and you cannot figure it out, please let me know, I will be happy to assist where possible.





Last Updated on Sunday, 28 March 2010 18:13  

Design Center Tips

Adobe Design Center RSS Feed
Learn how to use and integrate Adobe products with step-by-step tutorials on new features, key workflows, and advanced techniques.
  • Adobe - Lightroom 2.0 video tutorial : What's new in the Develop module?
    ...Adobe® Photoshop® Lightroom™ 2.0. Learn how to make nondestructive localized corrections using the new Adjustment Brush and Graduated Filter tools. Duration: 22 minutes 28 seconds Requirements To complete the tasks demonstrated in this tutorial, you need the following software:...
  • Adobe - Lightroom 2.0 video tutorial : The Template Browser
    ...In this short video tutorial, learn how to use the Template Browser in Adobe® Photoshop® Lightroom™. Chris Orwig discusses several of the templates included with Lightroom and shows you how to manipulate images within a template. Duration: 2 minutes 07 seconds Requirements To...
  • Adobe - Lightroom 2.0 video tutorial : What's new in the Library module?
    ...Adobe® Photoshop® Lightroom™ 2.0. Learn how to navigate the new Library layout, as well as how to import, organize, and find your images quickly. Duration: 26 minutes 23 seconds Requirements To complete the tasks demonstrated in this tutorial, you need the following software:...

Inside Gaming

  • I recently received the Mass Effect 2 game for Xbox 360 as a gift!  I've got to say, this is one hell of a sequel game to Mass Effect!  The storyline is as intense and involved as ever and the graphics and sound are unsurpassed!

    If I could complain at all, I'd complain about the time it takes to load a game.  Only take about a second to save one, but loading is more like 30 seconds - maybe more.  So, needless to say, moving around from the main screen to in-game can be quite time cumbersome and annoying.

    Read more...
  • Flashpoint just didn't get the high marks it deserved.  For those who like local, campaign play, this is the game for you.  It is intense, very difficult and will keep you on the edge of your seat figuring and carrying out that perfect strategy.

    There is a lot of evasive or eluding type play - meaning that you don't always have to engage the enemy just because you can see them.  If you want to survive in this game, you have to be tactically sound in your decisions, well disciplined, and patient.

    Read more...
  • The graphics were great, the individual scenes awesome, the length of play...   HIGHLY disappointing!  

    I played this game for just over 11 hours.  I don't consider myself a "gamer".  I've always thought of gamers as those who buy every new game as it becomes available to buy and play it straight through to the finish.  Some of these people even use the system to quickly play it, take it back or trade it in for another, or whatever.

    Read more...
  • Never go into battle alone! EA's Montreal development studio is changing the face of how people will play games. Delivering a groundbreaking strategic 3rd person co-op shooter unparalleled in the action genre, EA Montreal's ARMY OF TWO focuses on gameplay centered around TWO man missions, TWO man strategies, TWO man tactics and a TWO man advantage

    Fight along side your team-mate to become the deadliest two-man military outfit a government can buy. The breakthrough gameplay in ARMY OF TWO, with a live or adaptive AI partner, enables you to take advantage of two-man strategies like customizable weapons, vehicles, and tactical shooting.

    From TWO man sniping to parachuting, players will experience action-packed scenarios where they will have to use their wit, strength and a deadly arsenal of shared customizable weapons to successfully defeat their enemies and complete the mission at hand.

    Gamers will fight their way through war, turmoil and a conspiracy so vast it threatens the entire world. When one man is not enough, it's going to take an army of two to save us.

    Key Features

  • "Two Man" Gameplay-Co-op is no longer a mode, it's the game. Team up with a live or AI partner on two-man missions using two-man tactics to ultimately create an advantage that no enemy can withstand.
  • Partner AI-ARMY OF TWO delivers intelligent partner AI (PAI) that interacts, adapts, collaborates and learns from their human partner. The PAI will also react and adjust to the gamer's ability and how they play the game by taking the lead or following, driving strategy or taking orders. It is the dream of the human machine.
  • Customizable Weapons-Customize and upgrade dozens of deadly weapons and share them with your partner off or online.
  • Dynamic
Read more...
  • You are Commander Shepard of the starship Normandy and you are the last hope for all life in the Galaxy. Saren, a rogue member of the elite and untouchable Spectre agents, has discovered the secret to unleashing an apocalyptic force on the galaxy, and only you stand in his way.

    To save the lives of billions, you must do whatever it takes to stop Saren and prevent the return of an ancient force bent on the destruction of all organic life.

    • Experience a rich and engrossing story where your choices decide the fate of galaxy
    • Engage in emotionally charged interactions with the most realistic Digital actors ever seen in a Video game, using an innovative new dialog system
    • Immerse yourself in an incredible new adventure from world-famous masters of the RPG: BioWare
    • Dominate the battlefield with new individual squad member command system-Optimized controls designed specifically for the PC
    • High Resolution visuals - highly detailed textures, characters and environments
    • Fully customizable controls - you can re-map the control scheme any way you like
    • Run & Gun Control - You can assign biotic powers or skills to 'hot keys' allowing you to play Mass Effect with a heavier Focus on action
    • Decryption mini-game
    • New inventory screen GUI and functionality - The enhanced inventory system makes it easier for you to equip and modify your weapons and armor
    Read more...