NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming > CODE
Reload this Page PHP Function to Submit Site to Del.icio.us

CODE This forum is for posting code snippets and example scripts that aren't quite tutorials, but could be useful for others. You may post code snippets and/or completed scripts that you've written and want to share here.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 09-09-2007, 11:46 AM THREAD STARTER               #1 (permalink)
DNMedia.com
 
Michael's Avatar
Join Date: Jul 2007
Location: Maryland
Posts: 1,866
Michael has a reputation beyond reputeMichael has a reputation beyond reputeMichael has a reputation beyond reputeMichael has a reputation beyond reputeMichael has a reputation beyond reputeMichael has a reputation beyond reputeMichael has a reputation beyond reputeMichael has a reputation beyond reputeMichael has a reputation beyond reputeMichael has a reputation beyond reputeMichael has a reputation beyond repute
 


Breast Cancer Cancer Survivorship Myanmar Relief Parkinson's Disease Child Abuse Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009

PHP Function to Submit Site to Del.icio.us


Please Note:
1. $site must start with http://
2. $tags must be separated with spaces, not commas
3. $proxy_addy must start with http://
4. $use_proxy must be passed in as TRUE if you want to use a proxy
5. Make sure you have CURL installed.

I wrote this and I am giving you guys permission to use it however you want commercial or otherwise, just don't sell the code itself. Have fun!

Demo using this function can be found at BMBot.com.

rep appreciated

PHP Code:
<?php

function delicious_submit($user$pass$site$note$desc$tags$proxy_addy$proxy_port$use_proxy FALSE)
{
    
// Set curl options.
    
$user_agent "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
    
$ch curl_init();
    
curl_setopt($chCURLOPT_POST1);
    
curl_setopt($chCURLOPT_SSL_VERIFYHOST2);
    
curl_setopt($chCURLOPT_USERAGENT$user_agent);
    
curl_setopt($chCURLOPT_SSL_VERIFYPEERFALSE);
    
curl_setopt($chCURLOPT_COOKIEJARdirname(__FILE__).'/cookie.txt');
    
curl_setopt($chCURLOPT_COOKIEFILEdirname(__FILE__).'/cookie.txt');
    
curl_setopt($chCURLOPT_RETURNTRANSFER1);
    if(
$use_proxy){
        
curl_setopt($chCURLOPT_HTTPPROXYTUNNEL1);
        
curl_setopt($chCURLOPT_PROXY$proxy_addy);
        
curl_setopt($chCURLOPT_PROXYPORT$proxy_port);
    }

    
// Visit login page.
    
$url 'https://secure.del.icio.us/login';
    
$params '';
    
curl_setopt($chCURLOPT_POSTFIELDS$params);
    
curl_setopt($chCURLOPT_URL$url);
    
$result curl_exec($ch);
    
    
//Grab unique token.
    
$piece strstr($result"inkey\"");
    
$piece strstr($piece"value=\"");
    
$token substr($piece732);

    
// Log in with token, user and pass.    
    
$url 'https://secure.del.icio.us/login';
    
$params 'inkey=' $token '&user_name=' $user '&password=' $pass '&login=log%20in';    
    
curl_setopt($chCURLOPT_POSTFIELDS$params);
    
curl_setopt($chCURLOPT_URL$url);    
    
$result curl_exec($ch);    

    
// Submit the url.
    
$url 'http://del.icio.us/' $user '?url=' $site '&submit=save&jump=no';
    
curl_setopt($chCURLOPT_HTTPGET1);
    
curl_setopt($chCURLOPT_URL$url);
    
$result curl_exec($ch);

    
// Grab the new token.
    
$piece strstr($result"key\"");
    
$piece strstr($piece"value=\"");
    
$token substr($piece732);

    
// Grab the unique key code.
    
$piece strstr($result$user "?");
    
$piece substr($piecestrlen($user));
????: NamePros.com http://www.namepros.com/code/372081-php-function-submit-site-del-icio.html
    
$piece strstr($piece$user "?");
    
$quote strpos($piece"\"");
    
$len strlen($user);
    
$code substr($piece$len 1$quote $len 1);

    
// Submit the url, description, notes, and tags along with the new token and key code.
    
$url 'http://del.icio.us/' $user '?' $code;
    
$params 'url=' $site '&oldurl=' $site '&description=' $desc '&notes=' $note '&tags=' $tags '&jump=no&key=' $token;
????: NamePros.com http://www.namepros.com/showthread.php?t=372081
    
curl_setopt($chCURLOPT_POST1);
    
curl_setopt($chCURLOPT_POSTFIELDS$params);
    
curl_setopt($chCURL_OPT_URL$url);
    
$result curl_exec($ch);

    
curl_close($ch);
}

?>
Last edited by idevlabs; 09-09-2007 at 12:24 PM.
Michael is offline  
Old 09-09-2007, 11:52 AM   #2 (permalink)
Danltn.com
 
Daniel's Avatar
Join Date: May 2007
Location: Danltn.com / Nottingham, UK
Posts: 1,201
Daniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond repute
 


Ethan Allen Fund Ethan Allen Fund
Very nice, reputation left. I was thinking of writing one of these.
Daniel is offline  
Old 09-12-2007, 01:13 AM   #3 (permalink)
New Member
Join Date: Mar 2006
Posts: 3
seohyderabad is an unknown quantity at this point
 



hi


How to install this & how can i use 2 or three accounts at once
seohyderabad is offline  
Old 09-12-2007, 06:39 AM THREAD STARTER               #4 (permalink)
DNMedia.com
 
Michael's Avatar
Join Date: Jul 2007
Location: Maryland
Posts: 1,866
Michael has a reputation beyond reputeMichael has a reputation beyond reputeMichael has a reputation beyond reputeMichael has a reputation beyond reputeMichael has a reputation beyond reputeMichael has a reputation beyond reputeMichael has a reputation beyond reputeMichael has a reputation beyond reputeMichael has a reputation beyond reputeMichael has a reputation beyond reputeMichael has a reputation beyond repute
 


Breast Cancer Cancer Survivorship Myanmar Relief Parkinson's Disease Child Abuse Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
If by asking how to install it you're asking me to give you the rest of the code to have a working site, sorry... I'm not that generous

This is the hard part. If you need help making an html form and using a while loop you're best bet is www.Codewalkers.com or reading the manual.
Michael is offline  
Old 09-18-2007, 06:55 AM   #5 (permalink)
The original NP Emo Kid
 
liam_d's Avatar
Join Date: Jan 2005
Location: Plymouth, UK
Posts: 1,693
liam_d is a name known to allliam_d is a name known to allliam_d is a name known to allliam_d is a name known to allliam_d is a name known to allliam_d is a name known to all
 




Brilliant! Think i will use this for sure!!
liam_d is offline  
Old 09-18-2007, 11:26 AM   #6 (permalink)
Senior Member
 
Porte's Avatar
Join Date: May 2005
Location: I'm right here
Posts: 3,526
Porte has much to be proud ofPorte has much to be proud ofPorte has much to be proud ofPorte has much to be proud ofPorte has much to be proud ofPorte has much to be proud ofPorte has much to be proud ofPorte has much to be proud ofPorte has much to be proud of
 



Thanks for your precious code, rep left.
__________________
WP Theme Developer
Your One-stop for Premium Magazine/CMS WordPress Themes
Deluxe Themes
Porte is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 11:54 PM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger