Jump to content

PHP cURL to LinkShare


quasiman

Recommended Posts

Hi, I'm trying to login to my LinkShare account via curl, and it's redirecting me to the browser security page, stating:

The LinkShare Publisher Interface has the following requirements:

 

    * Internet Explorer 7, Firefox 3, or Safari 3.2.1 (and above)

    * JavaScript enabled

    * Cookies enabled

    * LinkShare.com and linksynergy.com added to trusted sites

    * SSL & TLS Support

 

See the folowing help topics for help on configuring your browser:

So apparently my login is basically working, but not quite...

Here's the code I'm using, any help would be appreciated!

// General Settings
$loginUsername = 'mylogin';
$loginPassword= 'mypassword';
$linkshare_cookie = "XXX" . sha1(time());
// Start login process
$linkstart = "http://www.linkshare.com/usloginbutton";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $linkstart);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_COOKIEJAR, $linkshare_cookie );
curl_setopt($ch, CURLOPT_COOKIEFILE, $linkshare_cookie );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2");
curl_exec($ch);

curl_setopt($ch, CURLOPT_URL, 'https://cli.linksynergy.com/cli/common/authenticateUser.php');
curl_setopt($ch, CURLOPT_POSTFIELDS,'loginUsername='.urlencode($loginUsername).
																		'&loginPassword='.urlencode($loginPassword).
																		'&front_url='.urlencode("").
																		'&postLoginDestination='.urlencode("/cli/publisher/home.php"));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_COOKIEJAR, $linkshare_cookie );
curl_setopt($ch, CURLOPT_COOKIEFILE, $linkshare_cookie );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2");
curl_exec($ch);

curl_close($ch);

Link to comment
https://forums.phpfreaks.com/topic/196397-php-curl-to-linkshare/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.