Jump to content
Sign in to follow this  
stankovski

[contribution] "Live Customer Support"

Recommended Posts

i am going to look at the parsing routine today (once I wake up...)

 

sometimes it seems like the xmsl call works and other times it seems to return on invalid/unknown response - this is very strange....


Reading is beneficial - Searching is enlightening

find answers at wiki.oscommerce.com/top

Share this post


Link to post
Share on other sites

i tried pulling some of the code out into a separate file which I could run to test the icq status, and even if I am offline and even quit the icq app, it shows I am online - this is very frustrating....

 

<?php

class newsboy {

 

var $xml_parser;

var $xml_file;

var $html;

var $open_tag ;

var $close_tag ;

 

//Class Constructor

function newsboy() {

$this->xml_parser = "";

$this->xml_file = "";

$this->html = "";

$this->open_tag = array( //these are the default settings but they are quite easy to modify

"NEWSBOY" => "n<!-- XML Starts here -->n",

"status" => "",

);

$this->close_tag = array(

"status" => "",

);

 

}

//Class Destructor (has to be invoked manually as PHP does not support destructors)

function destroy() {

xml_parser_free($this->xml_parser);

}

 

 

//Class Destructor (has to be invoked manually as PHP does not support destructors)

function destroy() {

xml_parser_free($this->xml_parser);

}

 

//Class Members

function concat($str) {

$this->html .= $str;

}

 

function startElement($parser, $name, $attrs) {

//global $open_tag;

 

if ($format= $this->open_tag[$name]) {

$this->html .= $format;

}

}

 

function endElement($parser, $name) {

global $close_tag;

 

if ($format= $this->close_tag[$name]) {

$this->html .= $format;

}

}

 

function characterData($parser, $data) {

$this->html .= $data;

}

 

function parse() {

$this->xml_parser = xml_parser_create();

xml_set_object($this->xml_parser, &$this);

// use case-folding so we are sure to find the tag in $map_array

xml_parser_set_option($this->xml_parser, XML_OPTION_CASE_FOLDING, true);

xml_set_element_handler($this->xml_parser, "startElement", "endElement");

xml_set_character_data_handler($this->xml_parser, "characterData");

//xml_set_processing_instruction_handler($this->xml_parser, "PIHandler");

 

 

 

 

if (!($fp = fopen($this->xml_file, "r"))) {

die("could not open XML input");

}

 

while ($data = fread($fp, 4096)) {

if (!xml_parse($this->xml_parser, $data, feof($fp))) {

die(sprintf("XML error: %s at line %d",

xml_error_string(xml_get_error_code($this->xml_parser)),

xml_get_current_line_number($this->xml_parser)));

}

}

}

}

 

 

$news = new newsboy();

$news->xml_file = "http://magik.dk/services/icq/xml/?uin=78546266";

$news->parse();

$_result = trim($news->html);

 

print substr_count($_result, "Online");

 

//if (substr_count($_result, "Online")!="1") header('Location: ../images/customer_support_offline.jpg');

//if (substr_count($_result, "Online")=="1") header('Location: ../images/customer_support_online.jpg');

 

 

$news->destroy();

?>


Reading is beneficial - Searching is enlightening

find answers at wiki.oscommerce.com/top

Share this post


Link to post
Share on other sites

I search all around, and came across many good support programs. I found a free one, which im using now.

http://www.get1on1.com

 

There is a 'Free' version that works just fine, and is limited compared to the expensive versions. Like I said, im using it on my OSC site at it works great! It doesn't 'refresh' the page every 5 seconds either.

 

Here is my box code

if ( $HTTPS !='on' ) 

{?> <div align="center"><SCRIPT LANGUAGE="JavaScript">

<!-- Hide from old browsers

function newscreen4() {

window.open("","talk","width=300,height=350,resizable=no,scrollbars=auto")

}

// Stop hiding from old browsers -->

Stamp = new Date();

year = Stamp.getYear();

document.write('<A HREF="http://www.get1on1.com/cmct/caller/start?clientid=4540" TARGET="talk" onclick="newscreen4()"><img src="http://www.get1on1.com/cmct/operator/icon?clientid=4540&'+Stamp+'" border=0></a>');

</SCRIPT> 

<?php 

} 

else 

{?> 

<?php 

} ?>

 

Since there seems to be no SECURE link for the icon, i've setup my column like this so that it does not show on secure pages. I hope to find out if there is a secure way to call on the script, since it has to be called from there servers:

if ($HTTPS !='on' ) {

 require(DIR_WS_BOXES . 'livechat.php');

 } else {



}

Share this post


Link to post
Share on other sites

Hello Everyone,

 

You can upload a fix for ICQ status problem. Please substitute files in the latest contribution with these ones:

main/functions.php

main/status.php

login/index.php

 

The changes I made were the following: in main/function.php I have removed newboy class and substituted it icq_status function. In other two files I simply adjusted the calling to the function.

 

Denis


Denis Stankovski

----------------------

http://www.harmoniouslifestyles.com

Share this post


Link to post
Share on other sites

i test it last night and is working great now !

 

Thanks Denis for this great contribution !

 

:wink:


Guido

Share this post


Link to post
Share on other sites

Hello!

 

First of all congratulations to this really great contrib! That's exactly what I was looking for...

 

But somehow the detection wether I'm online or offline doesn't work properly and I'm not sure if it's my error or an error of magik.dk or whatever...

 

I setup the whole thing this morning (for breakfast, yeah! ;o) ) and it seemed to work perfectly, except that the xml file returned from magik.dk always said that I'm offline (tried it in the browser), although I was happily sending ICQ-messages at the same time...

 

After work I thought I'd continue personalizing the whole thing - and suddenly my online/offline-status was working perfectly!

 

Now 2 hours later, after taking a small break with a refreshing coffee, I just return to my computer - and it's the same as in the morning!

 

So what is going on here? Is magik.dk monitoring my overall worktime and decides that I should now rather go to my sofa than spend even more time in front of the pc...? ;o)

 

Anybody any idea, what's going wrong?

 

Best regards,

Markus

Share this post


Link to post
Share on other sites

Hi together,

 

after another coffee, it is now working fine. I searched around a bit and finally found that the javascript-version of magik.dk always shows the correct status for me, so I changed the function icq_status() to:

 

function icq_status($icq) {

$handle = fopen ("http://magik.dk/services/icq/javascript/?uin=".$icq, "r"); // different url

while (!feof ($handle)) {

$buffer = fgets($handle, 4096);

$simple .= $buffer;

}

fclose ($handle);

 

ereg("document.write("([^"]+)");", $simple, $regs); //isolate status message with regular expression

//print_r($regs);

return $regs[1]; //return first match

}

 

That leaves still the question why the xml-version does not work, but there's still plenty of space left in the big brown folder called "X-Files"... ;o)

 

Anyway, perhaps it will help somebody else, too...

 

Good night!

Markus

Share this post


Link to post
Share on other sites

Hey Markus,

 

I do not know about X-Files (I wouldn't go that far) but somethinging is really buggy on their end. Unfortunately I do not know any other way to check status directly from ICQ server. Actually, there's been couple of scripts but they do not work any more. If anybody knows the sollution to this problem (getting status directly from ICQ server) it would be appreciated greatly.

 

Denis


Denis Stankovski

----------------------

http://www.harmoniouslifestyles.com

Share this post


Link to post
Share on other sites
Hey Markus,

 

I do not know about X-Files (I wouldn't go that far) but somethinging is really buggy on their end. Unfortunately I do not know any other way to check status directly from ICQ server. Actually, there's been couple of scripts but they do not work any more. If anybody knows the sollution to this problem (getting status directly from ICQ server) it would be appreciated greatly.

 

Denis

 

Hi denis I have been really busy in the past two seeks and I have not checked the site much but I just logged in and I notice the images are not showing. IS this due to the ICQ status problems or corrupted or missing files my end? I will have a look around but if its down to status problems I am stumped.

 

thanks in advance

Share this post


Link to post
Share on other sites
Hey Markus,

 

I do not know about X-Files (I wouldn't go that far) but somethinging is really buggy on their end. Unfortunately I do not know any other way to check status directly from ICQ server. Actually, there's been couple of scripts but they do not work any more. If anybody knows the sollution to this problem (getting status directly from ICQ server) it would be appreciated greatly.

 

Denis

 

You can see a fair bit about this in search engines but I am not sure how technical the info you require is.

 

http://5679soft.virtualave.net/status.html

 

The guy in the text file of his download might know. I will also carry on looking and post more URLS if they look hopeful.

 

http://www.ykwong.com/statufaq.html

 

http://javascript.internet.com/miscellaneo...icq-status.html

 

(the one above says that the servers get overloaded and do not show the image perhaps thats whats happening to me :)

 

http://www.zend.com/codex.php?id=216&single=1

 

http://www.eksperten.dk/spm/93933

 

http://www.faqchest.com/prgm/php-l/php-00/...1314_20240.html

 

http://www.phpbuilder.com/mail/php-general...000071/2321.php

 

http://www.hereintown.net/~wink/

(This one looks a little cranky but I like the way their ICpage updtes the status of ICQ so perhaps they know something to help you never know!)

 

http://www.beginnersphp.co.uk/icqstatus.php

 

 

 

 

that should do for now. Not sure if any of it is any good as I dont understand what you need to know but there might be something there.

Share this post


Link to post
Share on other sites
Hey Markus,

 

I do not know about X-Files (I wouldn't go that far) but somethinging is really buggy on their end. Unfortunately I do not know any other way to check status directly from ICQ server. Actually, there's been couple of scripts but they do not work any more. If anybody knows the sollution to this problem (getting status directly from ICQ server) it would be appreciated greatly.

 

Denis

 

Anyone else not able to get the status online working any more??

Share this post


Link to post
Share on other sites

Anyone know what this means? I get this on my default page....

 

Fatal error: Failed opening required '../chat2.0/main/configure.php' (include_path='.:/php/includes:/usr/share/php') in /home/virtual/site26/fst/var/www/html/includes/boxes/chat.php on line 20

 

 

:( please help

Share this post


Link to post
Share on other sites

hi!

 

Thanks...it was set wrong...i had to chage it.....to 'chat2.0/blahblah/blah'.......but now my only issue is how to accept a pager message....any ideas?

 

do you use ICQ?

Share this post


Link to post
Share on other sites

It's not working again. Same error again. cant connect to 'status.icq.com'.

 

Anybody else facing this problem?

 

Regards

Share this post


Link to post
Share on other sites

since the last modification its work perfect !

 

Thanx again Denis for this nice Contribution

 

 

jackof  

 

It's not working again. Same error again. cant connect to 'status.icq.com'.  

 

Anybody else facing this problem?  

 

Regards  

 

Please tell me the error message


Guido

Share this post


Link to post
Share on other sites

Hello Guido,

It's worknig now :)

It was a temporary error. I believe, icq's status server was down as i had checked with Denis's site too. It was not working there too.

Neways its working now :)

 

Thanks for the concern. :)

 

Regards

Share this post


Link to post
Share on other sites

just a question :

 

running someone else also in probs now ?

i chat with icq but the site shows the offline message.

and if i am offline then is there no picture and the link doesnt work anymore.

 

they ( ICQ ) play again with the servers ? :bomb:


Guido

Share this post


Link to post
Share on other sites

Yeah i beleive the status.icq.com server goes down very frequently. It's working fine now.

 

Regards,

Jack

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×