View Full Version : send YIM via php/javascript?

01-30-2007, 11:31 PM
I'm building a news web site. All over this internet I've seen the link 'SEND THROUGH MESSENGER' a link...
I need a script that can send through YIM the link on which the visitor is on the web site.
For example, if he reads http://...news.com/read.php?id=89 , when the visitor whould press the 'SEND THROUGH YIM' button, I want the script to generate the link he's visiting (http://...news.com/read.php?id=89). Get my point?
I'm looking forward for your replies...

01-31-2007, 01:55 AM
I'm not sure how with YIM, but I know AIM works like this:

<a href="aim?sendIM=screenname&message=hello">
At least... something close to that.

I think YIM is the same way. You can't actually send a message from a page, but just pop open a window. Note that this is also entirely dependant on the visitor having the app installed. the aim link will throw an error at you if you don't have aim installed.

If this works, then just go find one of those pages and copy the href it uses. It's a standard function, so I wouldn't worry about copyright for just that line of code.

01-31-2007, 05:51 AM
no dude, it's nt what I'm looking for.... I suppose it's either a php script, either javascript. any1?

01-31-2007, 09:56 AM
Hmm.. I'm not aware of such a feature.
One option is that it still is just YIM:.... or something, and that's all you need as the href (which could be generated by javascript if need be).
Once you're logged in to YIM and have a window open, perhaps it just knows to automatically 'type' that into your window.... not sure.

PHP is a serverside programming language, so wouldn't help the user do anything. Javascript could affect the link's href, but not actually do anything in another application.
I would assume there to be documentation on yahoo.com if such a feature is available.

For any further help, I'd need to see a link to a working page as an example.

01-31-2007, 10:18 AM
here you go...it's right on top of the page...

also, see my printscreen http://www.idonici.ropage.com/junk_yard/print.jpg
I really need this... it's really helpful...

01-31-2007, 10:26 AM
As I suspected, it's just a link. Javascript does a little with it as well.

Here's the tag:

<a href="javascript:void(0)" onclick="javascript:makeRequest('http://www.9am.ro/sendby_ym.php?art_id=53810&go_to=eW1zZ3I6aW0/KyZtc2c9aHR0cDovL3d3dy45YW0ucm8vc3RpcmktcmV2aXN0YS1wcmVzZWkvQWN0dWFsaXRhdGUvNTM4MTAvTWlvcml0YS11Y2lzYS1sYS1pbnRyYXJlYS1pbi1FdXJvcGE=','');" style="font-size: 12px; color: red; text-decoration: underline;" class="title_link" title="Trimite articolul prin Yahoo Messenger">Trimite prin Y!M</a>

However, ignoring the supposed complexity there, here's what appears to be the href generated, according to FF... try playing with this:

I suspect that just using:
<a href="ymsgr:im?+&msg=Hello">
would work just fine.

Also, I suspect the +&* without something it's adding means that the correct for mat is something like:
Or, something like that, anyway.
*Not sure why the & and + are both there. Perhaps the + is just acting like a space as it does in a 'real' URL.

01-31-2007, 11:00 AM
ok. I got the idea.
Now, I've tried to send through YIM, the link (the news) on which the visitor is.

$interogare = "select id as res_id,'http://www.site.biz/site/read_sport' as link,titlu_continut,continut from sport where ID = '$id'";
$rezultat = mysql_query($interogare);
while($rand = mysql_fetch_array($rezultat))
echo '<a href=\"ymsgr:im?+&msg=$rand[link].php?id='.$rand['res_id']"\">Send through YIM</a>';

..but I guess I can't really understand the COMMAS...because I get:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in site/read_sport.php on line 63
...can you still help me?

01-31-2007, 11:21 AM
Note the changes, in red:
echo '<a href=\"ymsgr:im?+&msg='.$rand[link].'.php?id='.$rand['res_id'].'"\">Send through YIM</a>';
Also, $rand[link] may work sometimes (or all the time, depending on the server and things I don't know all the details on), but it's proper to put single quotes around the items in an array... $rand['link'].

01-31-2007, 11:30 AM
GOT IT... thanks man...
the final code:

$interogare = "select id as res_id,'http://www.site.biz/site/read_sport' as link,titlu_continut,continut from actualitate where ID = '$id'";
$rezultat = mysql_query($interogare);
while($rand = mysql_fetch_array($rezultat))
echo '<a href="ymsgr:im?+&msg='.$rand['link'].'.php?id='.$rand['res_id'].'"">Send through YIM</a>';

...now I have to find out how to I make a printable page...
listen, don't get me wrong... I stayed on google last night for about 5h ... I also have php books.... but none of them present these kind of situations...

01-31-2007, 12:04 PM
experience does a lot more than books ever can.

now that you've started a new thread (and it is on enough of a new topic to justsify it, I think), consider this one over (unless there is a specific question about this), as to not have two threads about the same thing. Thanks.
For the printing question, ask/discuss there.