Ebay Wishlist : Need tfix a thing about CURL in HTTPS

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
koolheaven
Forum Newbie
Posts: 14
Joined: Tue Aug 08, 2006 3:55 pm

Ebay Wishlist : Need tfix a thing about CURL in HTTPS

Post by koolheaven »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hey!!

Need your help to fix a single thing about CURL in HTTPS.

Here is the cofe:

Code: Select all

<form method="post" name="single" id="single"> 
<input type="hidden" name="do" value="single">ysers: 
<textarea name="userb"><?php echo $_POST['userb']; 
?></textarea> 
<input type="submit" value="Extract"></form> 

<form method="post" name="lici" id="lici"><input type="hidden" name="do" 
value="lici" />ebay lici: 
<textarea name="linkb"><?php echo $_POST['linkb']; 
?></textarea> 
<input type="submit" value="Extract" /></form> 



<?php 
set_time_limit(0); 
ini_set("memory_limit","64M"); 
if (!(function_exists('curl_init'))) { echo("<b><font size=5>Error: 
cURL not 
installed.</font></b>"); exit; } 
if($_SERVER["REQUEST_METHOD"] == POST) { 

$user = ''; //ebay username 
$pass = ''; //ebay password 
$linkb = $_POST['linkb']; 
$userb = $_POST['userb']; 
$do = $_POST['do']; 
$cookie = "cookie-".rand(1000,100000); 

function curl($url, $cookie='', $post='') 
{ 

$rand = rand(100000,400000); 
$agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) 
Gecko/".$rand." Netscape/7.1 (ax)"; 
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $url); 
curl_setopt($ch, CURLOPT_USERAGENT, $agent); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 
if($post !== '') 
if($cookie !== '') 
{ 

curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie); 
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie); 
} 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
$result = curl_exec ($ch); 
curl_close ($ch); 
if($result == "") 
{ 
curl($url, $cookie, $post); 
} 
else 
{ 
return $result; 
} 
} 

function login($user, $pass) 
{ 
global $cookie; 
$getcookie = curl("https://signin.ebay.com/ws/eBayISAPI.dll?SignIn", $cookie); 
// echo $getcookie; 
// exit; 

$login = curl("https://signin.ebay.com/ws/eBayISAPI.dll?SignIn&co_partnerid=2&siteid=0&".
"UsingSSL=1&pageType=&pa1=&i1=&bshowgif=&UsingSSL=&ru=&pp=&pa2=&errmsg=&".
"runame=&ruparams=&ruproduct=&sid=&favoritenav=&confirm=&ebxPageType=&".
"existingEmail=&isCheckout=&migrateVisitor=", $cookie, "MfcISAPICommand=SignInWelcome&siteid=0&co_partnerId=2&UsingSSL=1&i1=-1&pageType=-1&userid=".$user."&pass=".$pass); 
/* https://signin.ebay.com/ws/eBayISAPI.dl ... &siteid=0&
pageType=&pa1=&i1=&bshowgif=&UsingSSL=&ru=http%3A%2F%2Fwww.ebay.com&pp=&
pa2=&errmsg=&runame=&ruparams=&ruproduct=&sid=&favoritenav=&confirm=&
ebxPageType=&existingEmail=&isCheckout=&migrateVisitor=
*/
echo $login; 
if(strpos($login, "Hello,") !== false) { return true; } else 
{ 
@unlink($cookie); return false; 
} 
} 

function extractemail($userid) 
{ 
global $user, $cookie; 
$get = curl("cgi3.ca.ebay.com/ws/eBayISAPI.dll", $cookie, "MfcISAPICommand=LeaveMultiplseFeedback&userid=".$user."&pass=&which0=positive&i0=0000000000&ouser0=".$userid."&transactid0=8806049833&confirm0=0"); 
$mail = explode("mailto:", $get); 
$mail = explode('">', $mail[1]); 
if(strpos($get, "default&iid=0") !== false) { $mail[0] = ''; } 
return $mail[0]; 
} 

function extractbids($id) 
{ 
$get = curl("http://offer.ebay.com/ws/eBayISAPI.dll?ViewBids&item=".$id); 
foreach(explode('<td><a href="http://feedback.ebay.com/ws/eBayISAPI.dll?ViewFeedback&userid=', $get) as $bids) { 

if(strpos($user[0], "</table>") === false) { $users .= $user[0]."\n"; } 
} 
return array_unique(explode("\n", $users)); 
} 

if(login($user, $pass) == false) 
{ 
echo "i can't login"; 
exit(); 
} 

if($do == 'single') { 
foreach(explode("\n", $userb) as $userbb) { 
echo extractemail(trim($userbb))."<br>"; 
} } 

if($do == 'lici') { 
foreach(explode("\n", $linkb) as $linkbb) { 
$bids = extractbids(trim($linkbb)); 
foreach($bids as $users) { echo extractemail($users)."<br>"; } 
} } 
@unlink($cookie); 
} 
?>

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

What's not working?
Post Reply