| 
	
 | 
 Posted by Henk oegema on 05/11/07 09:25 
The script below, is a script that logs on to my VoIPBuster account and 
(should) returns the remaining credit. 
During debugging I found that the script stops at  
$ch = curl_init(); 
 
I get Error message: 
CALL TO UNDEFINED FUNCTION curl_init(); 
 
Can someone please explain what to do? 
 
=================================================================================== 
<?php 
 
function encryptString($string)  
{ 
for($i=0; $i < strlen($string); $i++) 
{ 
    if(is_numeric($string[$i])) 
      { 
        if($string[$i] < "5") 
            $string[$i] = $string[$i] + 5; 
        else 
            $string[$i] = $string[$i] - 5; 
      } 
}  
return str_rot13($string); 
} 
  
// Set username and password 
$username = encryptString('yyyyyyyyy'); 
$password = encryptString('xxxxxx'); 
 
$URL = 
('https://myaccount.voipbuster.com/clx/index.php?part=plogin&username=' . 
$username . '&password=' . $password); 
 
// INIT CURL 
$ch = curl_init();  //HERE THE SCRIPT STOPS !!  :-( 
 
# Setting CURLOPT_RETURNTRANSFER variable to 1 will force cURL 
# not to print out the results of its query. 
# Instead, it will return the results as a string return value 
# from curl_exec() instead of the usual true/false. 
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 
 
// EXECUTE 1st REQUEST (FORM LOGIN) 
$store = curl_exec ($ch); 
// SET Message 
curl_setopt($ch, 
CURLOPT_URL, 'https://myaccount.voipbuster.com/clx/notifications.php'); 
 
 
// ENABLE HTTP POST 
curl_setopt ($ch, CURLOPT_POST, 1); 
 
// SET POST PARAMETERS : FORM VALUES FOR EACH FIELD 
curl_setopt ($ch, CURLOPT_POSTFIELDS, '?fromlogin=true'); 
 
 
 
// EXECUTE 2nd REQUEST (Send Message) 
$content = curl_exec ($ch); 
 
// CLOSE CURL 
curl_close ($ch); 
 
/* 
At this point you can do do whatever you want 
with the downloaded file stored in $content : 
display it, save it as file, and so on. 
*/ 
       
//we gaan evenetje knippen in de ruwe source code van de returnwaarde 
//bestudeer de html source en alles wordt duidelijk 
$start = strpos($content,'balanceid'); //bepaal start van balanceid 
$deelstring = substr($content,$start+26,10); //kopieer het begin van het 
bedrag de string naar een tussen waarde 
//print $deelstring; 
$einde = strpos($deelstring,'<'); //einde van het bedrag is waar de afsluit 
tag begint 
$bedrag = substr($deelstring,0,$einde); 
print $bedrag; 
?> 
===================================================================================
 
  
Navigation:
[Reply to this message] 
 |