Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[contribution] "Live Customer Support"


stankovski

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....

Link to comment
Share on other sites

  • Replies 160
  • Created
  • Last Reply

Top Posters In This Topic

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();

?>

Link to comment
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 {



}

Link to comment
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

Link to comment
Share on other sites

  • 3 weeks later...

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

Link to comment
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

Link to comment
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

Link to comment
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

Link to comment
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.

Link to comment
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??

Link to comment
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

Link to comment
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?

Link to comment
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

Link to comment
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

Link to comment
Share on other sites

  • 2 weeks later...

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:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...