"); echo ''; echo ''; echo ''; //header("Location: /wap/index.wml"); // exit; } else { $wapuser = false; echo ''; echo ''; echo ' TelWeb '; echo "\n\n"; } /* // We empty the buffer and send the first part of the web page to the user: flush(); ob_flush(); echo "\n"; flush(); ob_flush(); flush(); ob_flush(); */ //#################################################################################################################### // We check not to overuse this script, and also avoids making the same call twice when clicked double. $counter_file = "ultimacces.txt"; if (file_exists($counter_file)) $visits = file($counter_file); else $visits[0]=0; if($visits[0] + 3 > time()) showerror("Server overuse. Please wait 10 seconds.."); $fp = fopen($counter_file , "w"); fputs($fp , time()); fclose($fp); //#################################################################################################################### // Variable/parameters control // En cas de cridar el script sense parametres / In case of calling this script directly without parameters if ($_REQUEST["tela"] =='' && $_REQUEST["telb"] =='' && $_REQUEST["us"] =='' && $_REQUEST["ps"] =='' && $_REQUEST["provider"] =='') { showerror(''); } // Usuari i contrasenya / Account user and password if(!isset($_REQUEST["us"]) || !isset($_REQUEST["ps"])) { showerror("Missing Login information"); } $usuari = $_REQUEST["us"]; $contrasenya = $_REQUEST["ps"]; if($usuari == "") { showerror("Login name cannot be empty"); } if($contrasenya == "") { showerror("Password cannot be empty"); } // $disp=1; // Ensenya el header i el contingut de les pàgines que descarrega. / Show the header and the content of the downloaded pages if($_REQUEST["disp"] > 0) { $disp=1; } // tela= Telèfon origen / Source telephone // telb= Telèfon destí / Destination telephone if (isset($_REQUEST["tela"]) && $_REQUEST["tela"] != "") { $tela= $_REQUEST["tela"]; }else{ showerror("Missing TelA"); } if (isset($_REQUEST["telb"]) && $_REQUEST["telb"] != "") { $telb= $_REQUEST["telb"]; }else{ showerror("Missing TelB"); } if ($tela == $telb) { showerror("TelA = TelB"); } // Força un prefix als numeros de telèfon / Forces the telephone numbers to have one prefix if($_REQUEST["forcea"] !="") { $tela = $_REQUEST["forcea"] . $tela; } if($_REQUEST["forceb"] !="") { $telb = $_REQUEST["forceb"] . $telb; } // Si un número de telèfon no està en format internacional, assumeix que te aquest prefix / If one telephone number is not specified in the international format, it assumes it will have as prefix if($_REQUEST["default"] !="") { if (substr($tela,0,2)!= "00" && substr($tela,0,1)!= "+") { $tela = $_REQUEST["default"] . $tela; } if (substr($telb,0,2)!= "00" && substr($telb,0,1)!= "+") { $telb = $_REQUEST["default"] . $telb; } } if (strlen($tela)<5 || (substr($tela,0,2)!= "00" && substr($tela,0,1)!= "+") || !is_numeric($tela)) { showerror("Invalid number tela: $tela"); } if (strlen($telb)<5 || (substr($telb,0,2)!= "00" && substr($telb,0,1)!= "+") || !is_numeric($telb)) { showerror("Invalid number telb: $telb"); } if (substr($tela,0,1) == "+") { $tela = "00" . substr($tela,1); } if (substr($telb,0,1) == "+") { $telb = "00" . substr($telb,1); } // $easyvoip=1; // system used by easyvoip if(isset($_REQUEST["easyvoip"])) { $easyvoip = $_REQUEST["provider"]; } // Proveidor de Betamax / Betamax provider used ex: justvoip.com, voipbusterpro.com, internetcalls.com ... if(isset($_REQUEST["provider"])) { $servidor = 'https://www.' . $_REQUEST["provider"]; // . '.com'; if($_REQUEST["provider"] == "easyvoip.com") $easyvoip = 1; } //if($easyvoip == 1) //{ /* //We aprox that tela/telb is in format "0049176000000" where 49 is the country (only 2 digit) $country_from = substr($tela,2,2); $country_to = substr($telb,2,2); $prefix_from = "%2B" . substr($tela,2,2); $prefix_to = "%2B" . substr($telb,2,2); $phonenumber_from = substr($tela,4); $phonenumber_to = substr($telb,4); */ list($country_from, $phonenumber_from, $paisa) = findprefix($tela); list($country_to, $phonenumber_to, $paisb) = findprefix($telb); $prefix_from = "%2B" . $country_from; $prefix_to = "%2B" . $country_to; //} // Url del compte Betamax (No necessari) / Betamax account URL (Not needed) ex. 'https://myaccount.justvoip.com' if(isset($_REQUEST["server"])) { $servidor = $_REQUEST["server"]; } if($servidor == "") { $servidor = "https://www.justvoip.com"; } echo "TelA: $tela TelB: $telb
"; if ($_REQUEST['hidecountry'] != 1){ echo $paisa . " => " . $paisb . "
\n"; } echo "Connecting..
\n"; // We empty the buffer and send the first part of the web page to the user: flush(); ob_flush(); echo "\n"; flush(); ob_flush(); flush(); ob_flush(); if($_REQUEST["myaccount1"] !="") { $myaccount1 = $_REQUEST["myaccount1"]; } else { // $myaccount1 = $servidor . "/myaccount/index.php"; $myaccount1 = $servidor . "/login/"; } // if($easyvoip == 1) // { // $myaccount1 = "https://www.easyvoip.com/login/"; //} //#################################################################################################################### //#################################################################################################################### //#################################################################################################################### //#################################################################################################################### if ($_REQUEST["method"] != 1) { require_once('simpletest/browser.php'); $browser = &new SimpleBrowser(); $impresTmp = $browser->get($servidor); if($disp==1) print "
1Ahead:" ; //$impresTmp = $browser->get($myaccount1); $impresTmp = $browser->click('login'); if($disp==1) print "
2Ahead:" ; $captcha = tallaEntre($impresTmp, ''); if ($captcha != '') { //echo ''; echo "
Betamax added a Captcha to your request and therefore the call cannot be performed automatically!
\n"; printFinal(); exit(); } $browser->setFieldById('login[username]', $usuari); $browser->setFieldById('login[password]', $contrasenya); $impresTmp = $browser->click('Login'); //$browser->submitFormById('login-form'); if($disp==1) print "
3Ahead:" ; $captcha = tallaEntre($impresTmp, ''); if ($captcha != '') { //echo ''; echo "
Betamax added a Captcha to your request and therefore the call cannot be performed automatically!
\n"; printFinal(); exit(); } $browser->get($servidor . "/phone_to_phone/"); //list($country_from, $phonenumber_from, $paisa) = findprefix($tela); //list($country_to, $phonenumber_to, $paisa) = findprefix($telb); $browser->setField('phonenumber_from', $phonenumber_from); $browser->setField('phonenumber_to', $phonenumber_to); $browser->setField('country_from', $country_from); $browser->setField('prefix_from', '+' . $country_from); $browser->setField('country_to', $country_to); $browser->setField('prefix_to', '+' . $country_to); $impres = $browser->clickSubmitById('call-button'); if($disp==1) print "
4Ahead:" ; $balance = tallaEntre($impres, '', '<'); } else{ //#################################################################################################################### //#################################################################################################################### // 1) Inici/Start: $be = new BrowserEmulator(); $be->debug = $disp; $be->addHeaderLine("Referer", $servidor . "/myaccount/index.php?part=timeout"); // $be->addHeaderLine("Referer", "https://www.justvoip.com/myaccount/index.php"); // $be->addHeaderLine("Accept-Encoding", "x-compress; x-zip"); $be->addHeaderLine("Accept",'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*'); $be->addHeaderLine("Accept-Language",'ca'); $be->addHeaderLine("User-Agent",'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'); if($easyvoip != 1) { $be->addPostData("part", "menu"); } //$be->addPostData("username", $usuari); //$be->addPostData("password", $contrasenya); $file = $be->fopen($myaccount1); $response = $be->getLastResponseHeaders(); //Getting the first Session ID: $sessio = trobaSessio($response); $impres= ""; while ($line = fgets($file, 1024)) { // do something with the file $impres .= $line; } if($easyvoip == 1){ //Getting the new ID (for the case of easyvoip for example): // $id1 = tallaEntreUltima($impres, '"); $id2 = tallaEntre($tagID, 'value="', '"'); } if ($disp==1) { echo "
1head:
"; echo "
1body:
"; echo "
sessio='" . $sessio . "'
"; echo "
id1='" . $id1 . "'
"; echo "
id2='" . $id2 . "'
"; } //At the moment, the Betamax server do not check the variable windowm and therefore it's not needed to be read: $windowm = ""; //We wait 50ms usleep(50); if($_REQUEST["slow"] ==1) //New parameter. When the script does not work, this method is slower but safer. { //#################################################################################################################### // 2) Opening setwindowname.php - Sometimes it is required: $be2 = new BrowserEmulator(); $be2->debug = $disp; $be2->addHeaderLine("Referer", $servidor . "/myaccount/index.php"); $be2->addHeaderLine("Accept",'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*'); $be2->addHeaderLine("Accept-Language",'ca'); $be2->addHeaderLine('Content-Type','application/x-www-form-urlencoded'); $be2->addHeaderLine("User-Agent",'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'); $be2->addHeaderLine("Cookie", "TRACKERID=" . $sessio . "; windowname=" . $windowm ); $file2 = $be2->fopen($servidor . "/myaccount/setwindowname.php"); $impres=""; if ($disp==1) { $response2 = $be2->getLastResponseHeaders(); echo "
2head:
"; echo "
2body:
"; //echo "Impres='$impres'"; echo "Windowname='$windowm'"; } } //#################################################################################################################### // 3) Performing login: $be3 = new BrowserEmulator(); $be3->debug = $disp; $be3->addHeaderLine("Referer", $myaccount1); //$be3->addHeaderLine("Accept-Encoding", "x-compress; x-zip"); $be3->addHeaderLine("Accept",'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*'); $be3->addHeaderLine("Accept-Language",'ca'); $be3->addHeaderLine('Content-Type','application/x-www-form-urlencoded'); $be3->addHeaderLine("User-Agent",'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'); if ($easyvoip != 1) { $be3->addHeaderLine("Cookie", "TRACKERID=" . $sessio . "; windowname=" . $windowm ); $be3->addPostData("part", "menu"); $be3->addPostData("username", $usuari); $be3->addPostData("password", $contrasenya); }else{ $be3->addHeaderLine("Cookie", "PHPSESSID=" . $sessio); // . "; rcalc_to_country=0; rcalc_from_country=0; rcalc_method=0"); $be3->addPostData($id1, $id2); $be3->addPostData("login%5Busername%5D", $usuari); $be3->addPostData("login%5Bpassword%5D", $contrasenya); } if($_REQUEST["myaccount2"] !="") { $myaccount2 = $_REQUEST["myaccount2"]; } else { $myaccount2 = $servidor . "/myaccount/index.php"; } if($easyvoip == 1) { $myaccount2 = "https://www.easyvoip.com/login"; } $file3 = $be3->fopen($myaccount2); $response3 = $be3->getLastResponseHeaders(); // Getting the new Sessio nID: $sessio_new = trobaSessio($response3); if ($sessio_new != "") $sessio = $sessio_new; $impres= ""; while ($line3 = fgets($file3, 1024)) { // do something with the file $impres .= $line3; } if ($disp==1) { echo "
3head:
"; echo "
3body:
"; echo "
sessio='" . $sessio . "'
"; } /* When tring several times with a wrong password, the login blocks for 1 hour and this error shows after login: "Username and/or password incorrect (error 4)
Your account has been blocked for security reasons. Even if you enter the correct password you still cannot access your account for at least one hour. Please wait and try again later. If you are uncertain about the correct username/password combination please check the registration email or request resending of your password. You can find this option next to the login fields.

" And the last try shows: "password incorrect (error 4) "..."For security reasons you have one more attempt before this username will be temporarily blocked. If you are uncertain about the correct username/password combination please check the registration email or request resending of your password. You can find this option next to the login fields." */ if (!(strpos($impres, "error") === false)) //"password incorrect (error 4)" { //echo "
Login/Password incorrect!
\n"; echo "
Login Error:
\n"; echo strip_tags(tallaEntre($impres, "

", "

")); echo "
"; printFinal(); exit(); } if($easyvoip ==1) { if($_REQUEST["slow"] ==1) { //#################################################################################################################### // 4) Loading buy_credit page (Optional) $be4 = new BrowserEmulator(); $be4->debug = $disp; $be4->addHeaderLine("Referer", $myaccount2); $be4->addHeaderLine("Accept",'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*'); $be4->addHeaderLine("Accept-Language",'ca'); $be4->addHeaderLine("User-Agent",'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'); $be4->addHeaderLine("Cookie", "PHPSESSID=" . $sessio . "; rcalc_to_country=0; rcalc_from_country=0; rcalc_method=0"); $file4 = $be4->fopen("https://www.easyvoip.com/buy_credit/"); if ($disp==1) { $response4 = $be4->getLastResponseHeaders(); echo "
4head:
"; echo "
4body:
"; } } //#################################################################################################################### // 4b) Loading phone_to_phone and getting ID $be4b = new BrowserEmulator(); $be4b->debug = $disp; $be4b->addHeaderLine("Referer", $myaccount2); $be4b->addHeaderLine("Accept",'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*'); $be4b->addHeaderLine("Accept-Language",'ca'); $be4b->addHeaderLine("User-Agent",'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'); $be4b->addHeaderLine("Cookie", "PHPSESSID=" . $sessio . "; rcalc_to_country=0; rcalc_from_country=0; rcalc_method=0"); $file4b = $be4b->fopen("https://www.easyvoip.com/phone_to_phone/"); $impres= ""; while ($line4b = fgets($file4b, 1024)) { $impres .= $line4b; } //Getting the new ID (for the case of easyvoip for example): // $id1 = tallaEntreUltima($impres, '"); $id2 = tallaEntre($tagID, 'value="', '"'); $balance = tallaEntre($impres, '', '<'); if ($disp==1) { $response4b = $be4b->getLastResponseHeaders(); echo "
4Bhead:
"; echo "
4Bbody:
"; echo "
id1='" . $id1 . "'
"; echo "
id2='" . $id2 . "'
"; } } if($_REQUEST["slow"] ==1) //New parameter. When the script does not work, this method is slower but safer. { //We wait 100ms usleep(100); //#################################################################################################################### //Opening main page - Sometimes it is required: (OPTIONAL) $be4 = new BrowserEmulator(); $be4->debug = $disp; $be4->addHeaderLine("Referer", $servidor . "/myaccount/index.php"); //$be4->addHeaderLine("Accept",'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*'); //$be4->addHeaderLine("Accept-Language",'ca'); //$be4->addHeaderLine("User-Agent",'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'); $be4->addHeaderLine("Cookie", "TRACKERID=" . $sessio . "; windowname=" . $windowm ); $file4 = $be4->fopen($servidor . "/myaccount/index.php?part=menu&justloggedin=true"); //$file4 = $be4->fopen($servidor . "/clx/webcalls2.php?panel=true"); if ($disp==1) { $response4 = $be4->getLastResponseHeaders(); echo "
4head:
"; echo "
4body:
"; } //We wait 100ms usleep(200); //#################################################################################################################### //Opening resetwindow.php - Sometimes it is required: (OPTIONAL) $be4a = new BrowserEmulator(); $be4a->debug = $disp; $be4a->addHeaderLine("Referer", $servidor . "/myaccount/index.php?part=menu&justloggedin=true"); //$be4a->addHeaderLine("Accept",'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*'); //$be4a->addHeaderLine("Accept-Language",'ca'); //$be4a->addHeaderLine("User-Agent",'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'); $be4a->addHeaderLine("Cookie", "TRACKERID=" . $sessio . "; voipusername=" . $usuari . "; windowname=" . $windowm ); $file4a = $be4a->fopen($servidor . "/myaccount/resetwindow.php"); $impres=""; if ($disp==1) { $response4a = $be4a->getLastResponseHeaders(); echo "
4Ahead:
"; echo "
4Abody:
"; //echo "Impres='$impres'"; echo "Windowname='$windowm'"; } //We wait 100ms usleep(100); } //end if slow==1 if($_REQUEST["slow"] ==1) //New parameter. When the script does not work, this method is slower but safer. { //#################################################################################################################### //Opening /myaccount/webcalls2.php?panel=true without calling - Sometimes it is required: (OPTIONAL) $be4b = new BrowserEmulator(); $be4b->debug = $disp; $be4b->addHeaderLine("Referer", $servidor . "/myaccount/index.php?part=menu&justloggedin=true"); $be4b->addHeaderLine("Accept",'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*'); $be4b->addHeaderLine("Accept-Language",'ca'); $be4b->addHeaderLine('Content-Type','application/x-www-form-urlencoded'); $be4b->addHeaderLine("User-Agent",'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'); $be4b->addHeaderLine("Cookie", "TRACKERID=" . $sessio . "; voipusername=" . $usuari . "; windowname=" . $windowm ); $file4b = $be4b->fopen($servidor . "/myaccount/webcalls2.php"); if ($disp==1) { $response4b = $be4b->getLastResponseHeaders(); echo "
4Bhead:
"; echo "
4Bbody:
"; } // We empty the buffer and send the first part of the web page to the user: echo "\n"; flush(); ob_flush(); flush(); ob_flush(); flush(); ob_flush(); //We wait 300ms usleep(300); } //#################################################################################################################### // 5) Setting the call: $be5 = new BrowserEmulator(); $be5->debug = $disp; //$be5->addHeaderLine("Referer", $servidor . "/clx/webcalls2.php?panel=true"); //$be5->addHeaderLine("Accept-Encoding", "x-compress; x-zip"); //echo substr($servidor, 8); //$be5->addHeaderLine("Host", substr($servidor, 8)); //$be5->addHeaderLine("User-Agent",'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'); //$be5->addHeaderLine("Accept",'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*'); //$be5->addHeaderLine("Accept-Language",'ca'); //$be5->addHeaderLine("Accept-Encoding", "gzip,deflate"); //$be5->addHeaderLine("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7"); //$be5->addHeaderLine("Keep-Alive", "300"); //$be5->addHeaderLine("Connection", "keep-alive"); $be5->addHeaderLine("Referer", "https://www.easyvoip.com/phone_to_phone"); //$be5->addHeaderLine("Cookie", "PHPSESSID=" . $sessio . "; voipusername=" . $usuari . "; windowname=" . $windowm ); //$be5->addHeaderLine("Content-Type:", "application/x-www-form-urlencoded"); $be5->addHeaderLine("Accept",'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'); $be5->addHeaderLine("Accept-Language",'ca'); $be5->addHeaderLine('Content-Type','application/x-www-form-urlencoded'); $be5->addHeaderLine("User-Agent",'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'); if($easyvoip != 1) { $be5->addHeaderLine("Cookie", "TRACKERID=" . $sessio . "; voipusername=" . $usuari . "; windowname=" . $windowm ); $be5->addPostData("action", "initcall"); $be5->addPostData("panel", "true"); $be5->addPostData("anrphonenr", $tela); $be5->addPostData("bnrphonenr", $telb); } else { $be5->addHeaderLine("Cookie", "PHPSESSID=" . $sessio . "; rcalc_to_country=0; rcalc_from_country=0; rcalc_method=0"); $be5->addPostData($id1, $id2); $be5->addPostData("action", "call"); $be5->addPostData("country_from", $country_from); $be5->addPostData("country_to", $country_to); $be5->addPostData("prefix_from", $prefix_from); $be5->addPostData("prefix_to", $prefix_to); $be5->addPostData("phonenumber_from", $phonenumber_from); $be5->addPostData("phonenumber_to", $phonenumber_to); } if($_REQUEST["myaccount3"] !="") { $myaccount3 = $_REQUEST["myaccount3"]; } else { $myaccount3 = $servidor . "/myaccount/phone-to-phone.php"; } if($easyvoip == 1) { $myaccount3 = "https://www.easyvoip.com/phone_to_phone"; } $file5 = $be5->fopen($myaccount3); $response5 = $be5->getLastResponseHeaders(); if ($disp==1) { echo "
5head:
"; echo "
5body:
"; //#################################################################################################################### if ($impres == "") { // Calling failed. Last chance. Testing direct post method: echo "
Failed, trying again...
\n"; $be6 = new BrowserEmulator(); $be6->debug = $disp; $be6->addHeaderLine("Referer", $servidor . ""); $be6->addHeaderLine("Accept",'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*'); $be6->addHeaderLine("Accept-Language",'ca'); $be6->addHeaderLine('Content-Type','application/x-www-form-urlencoded'); $be6->addHeaderLine("User-Agent",'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'); //$be6->addHeaderLine("Cookie", "TRACKERID=" . $sessio . "; voipusername=" . $usuari . "; windowname=" . $windowm ); $file6 = $be6->fopen($servidor . "/myaccount/makecall.php?username=" . $usuari . "&password=" . $contrasenya . "&from=" . $tela . "&to=" . $telb); $response6 = $be6->getLastResponseHeaders(); if ($disp==1) { echo "
6head:
"; echo "
6body:
"; } } if ($impres == "") { // Still it failed echo "
Failed!
\n"; printFinal(); exit(); } echo "
Done
\n"; //#################################################################################################################### // We empty the buffer and send the first part of the web page to the user: echo "\n"; flush(); ob_flush(); flush(); ob_flush(); flush(); ob_flush(); //We wait 50ms //usleep(50); //#################################################################################################################### // Gets the current balance/prices (OPTIONAL) //hideprice=1 No mostra informació de preus / Hides pricing information if($_REQUEST["hideprice"] == 1){ printFinal(); exit(); } if($easyvoip == 1 || $_REQUEST["method"] != 1) { echo "Remains: " . $balance . "
\n"; } else { $variablesJavascript[1] = trobaPart($impres, 'connection1.send("', '");'); $variablesJavascript[2] = trobaPart($impres, 'connection2.send("', '");'); $variablesJavascript[3] = trobaPart($impres, 'connection3.send("', '");'); $variablesJavascript[4] = trobaPart($impres, 'connection4.send("', '");'); $variablesJavascript[5] = trobaPart($impres, 'connection5.send("', '");'); $variablesJavascript[6] = trobaPart($impres, 'connection6.send("', '");'); $variablesJavascript[7] = trobaPart($impres, 'connection7.send("', '");'); //######################################################## //Status (and the price of the current call): (OPTIONAL, ONLY FOR PRICES INFO) // getwebcallstatus2.php //$be9a = new BrowserEmulator(); //$be9a->addHeaderLine("Referer", $servidor . "/clx/webcalls2.php"); //$be9a->addHeaderLine("Accept-Encoding", "x-compress; x-zip"); //$be9a->addHeaderLine("Accept",'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*'); //$be9a->addHeaderLine("Accept-Language",'ca'); //$be9a->addHeaderLine('Content-Type','application/x-www-form-urlencoded'); //$be9a->addHeaderLine("User-Agent",'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'); //$be9a->addHeaderLine("Referer", $servidor . "/clx/index.php?part=menu&justloggedin=true"); //$be9b->addHeaderLine("Accept-Encoding", "x-compress; x-zip"); //$be9a->addHeaderLine("Accept",'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*'); //$be9a->addHeaderLine("Accept-Language",'ca'); //$be9a->addHeaderLine("Content-Type","application/x-www-form-urlencoded"); //$be9a->addHeaderLine("User-Agent",'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'); // $be9b->addHeaderLine("Cookie", "PHPSESSID=" . $sessio . "; voipusername=" . $usuari . "; windowname=" . $windowm ); //$be9a->addHeaderLine("Cookie", "PHPSESSID=" . $sessio . "; voipusername=" . $usuari . "; windowname=" . $windowm . "; anrphn=" . $tela . "; bnrphn=" . $telb ); // $be9a->addPostData("part", "menu"); // $be9a->addPostData("username", $usuari); // $be9a->addPostData("password", $contrasenya); for($repeteix=1;$repeteix<=6;$repeteix++) { $variablesJavascriptX = $variablesJavascript[$repeteix]; $be9a = new BrowserEmulator(); $be9a->debug = $disp; //$be9a->addHeaderLine("Referer", $servidor . "/clx/webcalls2.php"); //$be9a->addHeaderLine("Accept-Encoding", "x-compress; x-zip"); //$be9a->addHeaderLine("Accept",'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*'); //$be9a->addHeaderLine("Accept-Language",'ca'); //$be9a->addHeaderLine('Content-Type','application/x-www-form-urlencoded'); //$be9a->addHeaderLine("User-Agent",'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'); $be9a->addHeaderLine("Referer", $servidor . "/myaccount/index.php?part=menu&justloggedin=true"); //$be9b->addHeaderLine("Accept-Encoding", "x-compress; x-zip"); $be9a->addHeaderLine("Accept",'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'); $be9a->addHeaderLine("Accept-Language",'ca'); $be9a->addHeaderLine("Content-Type","application/x-www-form-urlencoded"); $be9a->addHeaderLine("User-Agent",'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'); // $be9b->addHeaderLine("Cookie", "PHPSESSID=" . $sessio . "; voipusername=" . $usuari . "; windowname=" . $windowm ); $be9a->addHeaderLine("Cookie", "TRACKERID=" . $sessio . "; voipusername=" . $usuari . "; windowname=" . $windowm . "; anrphn=" . $tela . "; bnrphn=" . $telb ); $be9a->debug = false; // echo $variablesJavascriptX; /* echo "
var1" . tallaEntre($variablesJavascriptX,'var1=','&'); echo "
var2" . tallaEntre($variablesJavascriptX,'var2=','&'); echo "
var3" . tallaEntre($variablesJavascriptX,'var3=','&'); echo "
var4" . tallaEntre($variablesJavascriptX,'var4=','&'); echo "
var5" . tallaEntre($variablesJavascriptX,'var5=','&'); echo "
var9" . tallaEntre($variablesJavascriptX . '&','var9=','&'); $be9a->addPostData("var1",tallaEntre($variablesJavascriptX,'var1=','&')); $be9a->addPostData("var2",tallaEntre($variablesJavascriptX,'var2=','&')); $be9a->addPostData("var3",tallaEntre($variablesJavascriptX,'var3=','&')); $be9a->addPostData("var4",tallaEntre($variablesJavascriptX,'var4=','&')); $be9a->addPostData("var5",tallaEntre($variablesJavascriptX,'var5=','&')); $be9a->addPostData("var9",tallaEntre($variablesJavascriptX. '&','var9=','&')); */ $be9a->addPostData("PostStringMar","PostStringMar"); $be9a->PostStringMar = $variablesJavascriptX; $file9a = $be9a->fopen($servidor . "/myaccount/getwebcallstatus2.php"); // . $variablesJavascriptX); $response9a = $be9a->getLastResponseHeaders(); if ($disp==1) { echo "
9a-head:
"; echo "
9a-body:
"; /* $impres9a == "adialing;:50000;0;60;0;80000;60" From the JavaScript: ASideSetupCharge = parseInt(arrest[0]); ASideTariff = parseInt(arrest[1]); ASideTariffIntervall = parseInt(arrest[2]); BSideSetupCharge = parseInt(arrest[3]); BSideTariff = parseInt(arrest[4]); BSideTariffIntervall = parseInt(arrest[5]); */ // $impres9a == "AAA;BBB:CCC;DDD;EEE;FFF;GGG;HHH" === "adialing;:50000;0;60;0;80000;60" if (!(strpos($impres9a, ":") === false)) { $impres9aArray = split(":", $impres9a); // "AAA;BBB" if (!(stripos($impres9aArray[0], "adialing") === false)) { echo "Calling!
\n"; }else{ echo "Not calling?
\n"; } // "CCC;DDD;EEE;FFF;GGG;HHH" if (!(strpos($impres9aArray[1], ";") === false)) { $impres9aArray2 = split(";", $impres9aArray[1]); if (count($impres9aArray2) == 6) { echo "
"; echo "Price A: "; if ($impres9aArray2[0] > 0) echo centims($impres9aArray2[0]); if($impres9aArray2[1] > 0) echo " + " . centims($impres9aArray2[1]) . "/" . $impres9aArray2[2] . "s"; echo "
\n"; echo "Price B: "; if ($impres9aArray2[3] > 0) echo centims($impres9aArray2[3]); if($impres9aArray2[4] > 0) echo " + " . centims($impres9aArray2[4]) . "/" . $impres9aArray2[5] . "s"; echo "
\n"; } } $repeteix=7; // ==> exit for }else{ echo "Not calling. Trying again...
\n"; //$variablesJavascriptX = $variablesJavascript2; // We empty the buffer and send the first part of the web page to the user: echo "\n"; flush(); ob_flush(); flush(); ob_flush(); flush(); ob_flush(); //We wait 500ms usleep(500); } } //######################################################## // Remaining Balance: (OPTIONAL, ONLY FOR PRICES INFO) //getwebcallbalance.php $be9b = new BrowserEmulator(); $be9b->debug = $disp; $be9b->addHeaderLine("Referer", $servidor . "/myaccount/index.php?part=menu&justloggedin=true"); //$be9b->addHeaderLine("Accept-Encoding", "x-compress; x-zip"); $be9b->addHeaderLine("Accept",'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*'); $be9b->addHeaderLine("Accept-Language",'ca'); $be9b->addHeaderLine("Content-Type","application/x-www-form-urlencoded"); $be9b->addHeaderLine("User-Agent",'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'); // $be9b->addHeaderLine("Cookie", "PHPSESSID=" . $sessio . "; voipusername=" . $usuari . "; windowname=" . $windowm ); $be9b->addHeaderLine("Cookie", "TRACKERID=" . $sessio . "; voipusername=" . $usuari . "; windowname=" . $windowm . "; anrphn=" . $tela . "; bnrphn=" . $telb ); // $be3->addPostData("PHPSESSID", $sessio); // $be3->addPostData("windowname", "wci9we87do5k3o1c46hecn2n"); // $be9b->addPostData("part", "menu"); // $be9b->addPostData("username", $usuari); // $be9b->addPostData("password", $contrasenya); $file9b = $be9b->fopen($servidor . "/myaccount/getwebcallbalance.php?" . $variablesJavascript7); $response9b = $be9b->getLastResponseHeaders(); if ($disp==1) { echo "
9b-head:
"; echo "
9b-body:
"; // Format $impres9b == "1060000" == 10,60 eur if (strlen($impres9b)>1) { if ((int)($impres9b) < 1000) { echo "No credit!
\n"; }else{ echo "Remains: " . centimsBalance($impres9b) . "
\n"; } } } // not easyvoip // End if($easyvoip == 1 || $_REQUEST["method"] != 1) printFinal(); // Final / End //#################################################################################################################### //#################################################################################################################### //#################################################################################################################### //#################################################################################################################### function centims($price) { if (substr($price,-4) == "0000") { $price = substr($price,0,-4) . "c"; } elseif (substr($price,-3) == "000") { $price = substr($price,0,-4) . "," . substr($price,-4, 1) . "c"; } return $price; } //#################################################################################################################### function centimsBalance($price) { if (substr($price,-3) == "000") { $price = substr($price,0,-5) . "," . substr($price,-5, 2); //Eur }elseif (substr($price,-2) == "00") { $price = substr($price,0,-5) . "," . substr($price,-5, 3); //Eur }else { $price = substr($price,0,-5) . "," . substr($price,-5, 5); //Eur } return $price; } //#################################################################################################################### function showerror($missatge) { if($_REQUEST["provider"] == "") $_REQUEST["provider"] = 'justvoip.com'; if($_REQUEST["hidelogin"] != 3){ echo '' . $missatge . '
'; } if($_REQUEST["hidelogin"] >= 2){ echo '
TelA:
TelB:
'; }elseif($_REQUEST["hidelogin"] != 1){ echo '
TelA:
TelB:
User:
Pass:
Provider:
'; } printFinal(); exit(); } //#################################################################################################################### function printFinal() { echo "
" . gmdate("ymd D H:i:s") . ""; /* echo " SINTAXI DE LA URL ÉS LA SEGÜENT: / URL SINTAX IS AS FOLLOWS:
call.php?provider=justvoip&disp=0&default=0034&forcea=0034&forceb=0034&us=USER&ps=PASSWORD&tela=TELEPHONEA&telb=TELEPHONEB
No utilizeu aquesta web per males finalitats. La utilització de la mateixa implica acceptar la responsabilitat de tota possible sobrecàrrega del sistema de trucades utilitzat. Gràcies.
"; */ if ($wapuser) { echo '
'; echo '
'; } else { echo "\n\n"; echo ''; } } //#################################################################################################################### function tallaEntre($liniatext,$entre1,$entre2){ if (!(strpos($liniatext, $entre1) === false)) { $posGenIni = strpos($liniatext, $entre1) + strlen($entre1); //if (!(strpos($liniatext, $entre2) === false)) $posGenFin = strpos($liniatext, $entre2, $posGenIni); return substr($liniatext, $posGenIni, $posGenFin - $posGenIni); } return false; } //#################################################################################################################### function tallaEntreUltima($liniatext,$entre1,$entre2){ if (!(strpos($liniatext, $entre1) === false)) { $posGenIni = strrpos($liniatext, $entre1) + strlen($entre1); //if (!(strpos($liniatext, $entre2) === false)) $posGenFin = strpos($liniatext, $entre2, $posGenIni); return substr($liniatext, $posGenIni, $posGenFin - $posGenIni); } return false; } //#################################################################################################################### function trobaSessio($responseGen){ //foreach ($responseGen as $liniarespostaGen) <--It has to be the last PHPSESSID for ($i=count($responseGen); $i > 0; $i--) { $liniarespostaGen = $responseGen[$i - 1]; if (!(strpos($liniarespostaGen, "PHPSESSID=") === false)) { $posGenIni = strpos($liniarespostaGen, "PHPSESSID=") + 10; $posGenFin = strpos($liniarespostaGen, ";", $posGenIni); return substr($liniarespostaGen, $posGenIni, $posGenFin - $posGenIni); } if (!(strpos($liniarespostaGen, "TRACKERID=") === false)) { $posGenIni = strpos($liniarespostaGen, "TRACKERID=") + 10; $posGenFin = strpos($liniarespostaGen, ";", $posGenIni); return substr($liniarespostaGen, $posGenIni, $posGenFin - $posGenIni); } } return false; } //#################################################################################################################### function trobaPart($liniarespostaGen, $part1, $part2){ if (!(strpos($liniarespostaGen, $part1) === false)) { $posGenIni = strpos($liniarespostaGen, $part1) + strlen($part1); $posGenFin = strpos($liniarespostaGen, $part2, $posGenIni); return substr($liniarespostaGen, $posGenIni, $posGenFin - $posGenIni); } return false; } //#################################################################################################################### function findprefix($telefon){ $prefixes = array( "93" => "Afghanistan", "355" => "Albania", "213" => "Algeria", "1684" => "American Samoa", "376" => "Andorra", "244" => "Angola", "1264" => "Anguilla", "672" => "Antarctica", "1268" => "Antigua and Barbuda", "54" => "Argentina", "374" => "Armenia", "297" => "Aruba", "61" => "Australia", "43" => "Austria", "994" => "Azerbaijan", "1242" => "Bahamas", "973" => "Bahrain", "880" => "Bangladesh", "1246" => "Barbados", "375" => "Belarus", "32" => "Belgium", "501" => "Belize", "229" => "Benin", "1441" => "Bermuda", "975" => "Bhutan", "591" => "Bolivia", "387" => "Bosnia-Herzegovina", "267" => "Botswana", "55" => "Brazil", "246" => "British Indian Ocean Territory", "1284" => "British Virgin Islands", "673" => "Brunei Darussalam", "359" => "Bulgaria", "226" => "Burkina Faso", "257" => "Burundi", "855" => "Cambodia", "237" => "Cameroon", "1" => "Canada", "238" => "Cape Verde", "1345" => "Cayman Islands", "236" => "Central African Republic", "235" => "Chad", "56" => "Chile", "86" => "China", "57" => "Colombia", "269" => "Comoros", "242" => "Congo", "243" => "Congo Democratic Republic", "682" => "Cook Islands", "506" => "Costa Rica", "385" => "Croatia", "53" => "Cuba", "357" => "Cyprus", "420" => "Czech Republic", "45" => "Denmark", "253" => "Djibouti", "1767" => "Dominica", "1" => "Dominican Republic", "670" => "East Timor", "593" => "Ecuador", "20" => "Egypt", "503" => "El Salvador", "240" => "Equatorial Guinea", "291" => "Eritrea", "372" => "Estonia", "251" => "Ethiopia", "298" => "Faeroes Islands", "500" => "Falkland Islands", "679" => "Fiji", "358" => "Finland", "33" => "France", "594" => "French Guiana", "689" => "French Polynesia", "241" => "Gabon", "220" => "Gambia", "995" => "Georgia", "49" => "Germany", "233" => "Ghana", "350" => "Gibraltar", "30" => "Greece", "299" => "Greenland", "1473" => "Grenada", "590" => "Guadeloupe", "1671" => "Guam", "502" => "Guatemala", "224" => "Guinea", "245" => "Guinea-Bissau", "592" => "Guyana", "509" => "Haiti", "504" => "Honduras", "852" => "Hong Kong", "36" => "Hungary", "354" => "Iceland", "91" => "India", "62" => "Indonesia", "98" => "Iran", "964" => "Iraq", "353" => "Ireland", "44" => "Isle Of Man", "972" => "Israel", "39" => "Italy", "225" => "Ivory Coast", "1876" => "Jamaica", "81" => "Japan", "962" => "Jordan", "7" => "Kazakhstan", "254" => "Kenya", "686" => "Kiribati", "965" => "Kuwait", "996" => "Kyrgyzstan", "856" => "Laos", "371" => "Latvia", "961" => "Lebanon", "266" => "Lesotho", "231" => "Liberia", "218" => "Libya", "423" => "Liechtenstein", "370" => "Lithuania", "352" => "Luxembourg", "853" => "Macao", "389" => "Macedonia", "261" => "Madagascar", "265" => "Malawi", "60" => "Malaysia", "960" => "Maldives", "223" => "Mali", "356" => "Malta", "692" => "Marshall Islands", "596" => "Martinique", "222" => "Mauritania", "230" => "Mauritius", "262" => "Mayotte", "52" => "Mexico", "691" => "Micronesia", "373" => "Moldova", "377" => "Monaco", "976" => "Mongolia", "382" => "Montenegro", "1664" => "Montserrat", "212" => "Morocco", "258" => "Mozambique", "95" => "Myanmar", "264" => "Namibia", "674" => "Nauru", "977" => "Nepal", "31" => "Netherlands", "599" => "Netherlands Antilles", "687" => "New Caledonia", "64" => "New Zealand", "505" => "Nicaragua", "227" => "Niger", "234" => "Nigeria", "683" => "Niue", "6723" => "Norfolk Island", "850" => "North Korea", "1670" => "Northern Mariana Islands", "47" => "Norway", "968" => "Oman", "92" => "Pakistan", "680" => "Palau", "970" => "Palestinian Territory", "507" => "Panama", "675" => "Papua New Guinea", "595" => "Paraguay", "51" => "Peru", "63" => "Philippines", "48" => "Poland", "351" => "Portugal", "1" => "Puerto Rico", "974" => "Qatar", "262" => "Reunion", "40" => "Romania", "7" => "Russian Federation", "250" => "Rwanda", "685" => "Samoa", "378" => "San Marino", "239" => "Sao Tome and Principe", "966" => "Saudi Arabia", "221" => "Senegal", "381" => "Serbia", "248" => "Seychelles", "232" => "Sierra Leone", "65" => "Singapore", "421" => "Slovak Republic", "386" => "Slovenia", "677" => "Solomon Islands", "252" => "Somalia", "27" => "South Africa", "82" => "South Korea", "34" => "Spain", "94" => "Sri Lanka", "290" => "St Helena", "1869" => "St Kitts and Nevis", "1758" => "St Lucia", "1721" => "St Maarten", "508" => "St Pierre and Miquelon", "1784" => "St Vincent and the Grenadines", "249" => "Sudan", "597" => "Suriname", "268" => "Swaziland", "46" => "Sweden", "41" => "Switzerland", "963" => "Syrian Arab Republic", "886" => "Taiwan", "992" => "Tajikistan", "255" => "Tanzania", "66" => "Thailand", "228" => "Togo", "690" => "Tokelau", "676" => "Tonga", "1868" => "Trinidad and Tobago", "216" => "Tunisia", "90" => "Turkey", "993" => "Turkmenistan", "1649" => "Turks and Caicos", "688" => "Tuvalu", "1340" => "US Virgin Islands", "256" => "Uganda", "380" => "Ukraine", "971" => "United Arab Emirates", "44" => "United Kingdom", "1" => "United States", "598" => "Uruguay", "998" => "Uzbekistan", "678" => "Vanuatu", "58" => "Venezuela", "84" => "Viet Nam", "681" => "Wallis and Futuna", "967" => "Yemen", "260" => "Zambia", "263" => "Zimbabwe"); $telefon = trim($telefon); if (substr($telefon,0, 1) == "+") $telefon = trim(substr($telefon,1)); elseif (substr($telefon,0, 2) == "00") $telefon = trim(substr($telefon,2)); else return false; if (array_key_exists(substr($telefon,0,1), $prefixes)) { $prefix = substr($telefon,0,1); $tel = substr($telefon,1); }elseif (array_key_exists(substr($telefon,0,2), $prefixes)) { $prefix = substr($telefon,0,2); $tel = substr($telefon,2); }elseif (array_key_exists(substr($telefon,0,3), $prefixes)) { $prefix = substr($telefon,0,3); $tel = substr($telefon,3); }elseif (array_key_exists(substr($telefon,0,4), $prefixes)) { $prefix = substr($telefon,0,4); $tel = substr($telefon,4); }else { return false; } return array($prefix, $tel, $prefixes[$prefix]); } //FINAL //#################################################################################################################### /*************************************************************************** Browser Emulating file functions v2.0.1b (adaptat i millorat per / adapted & improved by: MMinoves) (c) Kai Blankenhorn www.bitfolge.de/browseremulator kaib@bitfolge.de This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. **************************************************************************** Changelog: v2.0.1b SSL and improvements by MMinoves v2.0.1 fixed authentication bug added global debug switch v2.0 03-09-03 added a wrapper class; this has the advantage that you no longer need to specify a lot of parameters, just call the methods to set each option added option to use a special port number, may be given by setPort or as part of the URL (e.g. server.com:80) added getLastResponseHeaders() v1.5 added Basic HTTP user authorization minor optimizations v1.0 initial release ***************************************************************************/ /** * BrowserEmulator class. Provides methods for opening urls and emulating * a web browser request. **/ class BrowserEmulator { var $headerLines = Array(); var $postData = Array(); var $authUser = ""; var $authPass = ""; var $port; var $lastResponse = Array(); var $debug = false; var $PostStringMar = ""; function BrowserEmulator() { $this->resetHeaderLines(); $this->resetPort(); } /** * Adds a single header field to the HTTP request header. The resulting header * line will have the format * $name: $value\n **/ function addHeaderLine($name, $value) { $this->headerLines[$name] = $value; } /** * Deletes all custom header lines. This will not remove the User-Agent header field, * which is necessary for correct operation. **/ function resetHeaderLines() { $this->headerLines = Array(); /*******************************************************************************/ /************** YOU MAX SET THE USER AGENT STRING HERE *******************/ /* */ /* default is "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)", */ /* which means Internet Explorer 6.0 on WinXP */ $this->headerLines["User-Agent"] = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"; /*******************************************************************************/ } /** * Add a post parameter. Post parameters are sent in the body of an HTTP POST request. **/ function addPostData($name, $value) { $this->postData[$name] = $value; } /** * Deletes all custom post parameters. **/ function resetPostData() { $this->postData = Array(); } /** * Sets an auth user and password to use for the request. * Set both as empty strings to disable authentication. **/ function setAuth($user, $pass) { $this->authUser = $user; $this->authPass = $pass; } /** * Selects a custom port to use for the request. **/ function setPort($portNumber) { $this->port = $portNumber; } /** * Resets the port used for request to the HTTP default (80). **/ function resetPort() { $this->port = 80; } /** * Make an fopen call to $url with the parameters set by previous member * method calls. Send all set headers, post data and user authentication data. * Returns a file handle on success, or false on failure. **/ function fopen($url) { $this->lastResponse = Array(); preg_match("~([a-z]*://)?([^:^/]*)(:([0-9]{1,5}))?(/.*)?~i", $url, $matches); $protocol = $matches[1]; $server = $matches[2]; $port = $matches[4]; $path = $matches[5]; if ($port!="") { $this->setPort($port); } elseif ($protocol == 'https://') // by marti: { $this->setPort(443); // $server = "ssl://" . $server; // print "PORT SEGUR"; } if ($path=="") $path = "/"; $socket = false; $old_error_state = error_reporting(0); $socket = fsockopen(($protocol == 'https://' ? 'ssl://' : '') . $server, $this->port, $errno, $errstr); // by marti error_reporting($old_error_state); if (!$socket) { //die ("Cannot connect: $errno - $errstr
\n"); die ("Error connecting to the server.
\n Error " . $errno . ": " .$errstr); } else{ $this->headerLines["Host"] = $server; if ($this->authUser!="" && $this->authPass!="") { $this->headerLines["Authorization"] = "Basic ".base64_encode($this->authUser.":".$this->authPass); } if (count($this->postData)==0) { $request = "GET $path HTTP/1.1\r\n"; } else { $request = "POST $path HTTP/1.1\r\n"; } if ($this->debug) echo $request . "
"; fputs ($socket, $request); if (count($this->postData)>0) { $PostStringArray = Array(); foreach ($this->postData AS $key=>$value) { $PostStringArray[] = "$key=$value"; } $PostString = join("&", $PostStringArray); if ($this->PostStringMar != "") $PostString = $this->PostStringMar; $this->headerLines["Content-Length"] = strlen($PostString); } foreach ($this->headerLines AS $key=>$value) { if ($this->debug) echo "$key: $value\r\n
"; fputs($socket, "$key: $value\r\n"); // echo "$key: $value\r\n"; } if ($this->debug) echo "\r\n
"; fputs($socket, "\r\n"); if (count($this->postData)>0) { if ($this->debug) echo "$PostString
"; fputs($socket, $PostString."\r\n"); } } if ($this->debug) echo "\r\n
"; if ($socket) { $line = fgets($socket, 1000); if ($this->debug) echo $line . "
"; $this->lastResponse[] = $line; $status = substr($line,9,3); while (trim($line = fgets($socket, 1000)) != ""){ if ($this->debug) echo "$line
"; $this->lastResponse[] = $line; if ($status=="401" AND strpos($line,"WWW-Authenticate: Basic realm=\"")===0) { fclose($socket); return FALSE; } } } return $socket; } /** * Make an file call to $url with the parameters set by previous member * method calls. Send all set headers, post data and user authentication data. * Returns the requested file as an array on success, or false on failure. **/ function file($url) { $file = Array(); $socket = $this->fopen($url); if ($socket) { $file = Array(); while (!feof($socket)) { $file[] = fgets($socket, 10000); } } else { return FALSE; } return $file; } function getLastResponseHeaders() { return $this->lastResponse; } } ?>