View Full Version : Access to XML ?
RxRob
November 13th, 2003, 11:12 AM
Do we have access to XML with rxmedical? If so, what's the URL to the XML files? I tried:
http://www.rxordersys.com/js_inv/xxxxxxxxxx.xml
and
http://www.rxordersys.com/xml_inv/xxxxxxxxxx.xml
But neither works. Can someone unlighten me?
*Edit* Unlinked URL's.
redex
November 13th, 2003, 01:41 PM
I think that answer is no smileys/smiley6.gif
rxcdn
November 13th, 2003, 02:03 PM
The XML order system is coming in approx. 3 weeks, (I was told) so maybe the price schedules will be too.
FYI, this will give you a nice php file from the javascript file:
$result = preg_replace("/<!-- Begin/","<?php",$result);
$result = preg_replace("/\/\/.*End --\>/","?>",$result);
$result = preg_replace("/\)\}/",");}",$result);
then you can use PHP's variable functions:
<?=id_46_price()?>
<?=id_46_ship()?>
Going from memory, but it does work and no slowdown. Pretty cool actually!
scottdaman
November 13th, 2003, 04:16 PM
Rxcdn,
Awesome update. That is very good to know. I was wondering the same thing.
RxRob
November 13th, 2003, 07:12 PM
Thanks rxdn!
You say you don't notice any slowdown?
I'll see if I can doctor your codeso that it creates an associative array and it only gets called once per session.
rxcdn
November 13th, 2003, 08:16 PM
No slowdown but I run the regexps and it caches automatically
instead of assoc arrays, on first page view curl ONLY the header of the remote js file. compare last-modified with filemtime(2003xxxx.ps) of locally cached php version. if newer, (which means you updated prices) fetch the whole js file/parse/cache routine, else set $sessup2date=1
on each page just have if($sessup2date) include(2003xxx.php) else FetchRemoteHead() etc... You only fetch the remote on first visit.
99% of the time you work from the local version and never have that evil javascript on your page!
scottdaman
November 13th, 2003, 08:42 PM
smileys/smiley5.gifhttp://www.rxaffiliateforum.com/smileys/smiley5.gifhttp://www.rxaffiliateforum.com/smileys/smiley5.gifhttp://www.rxaffiliateforum.com/smileys/smiley5.gifhttp://www.rxaffiliateforum.com/smileys/smiley5.gifhttp://www.rxaffiliateforum.com/smileys/smiley5.gifhttp://www.rxaffiliateforum.com/smileys/smiley5.gifhttp://www.rxaffiliateforum.com/smileys/smiley5.gifhttp://www.rxaffiliateforum.com/smileys/smiley5.gifhttp://www.rxaffiliateforum.com/smileys/smiley5.gifhttp://www.rxaffiliateforum.com/smileys/smiley5.gifhttp://www.rxaffiliateforum.com/smileys/smiley5.gifhttp://www.rxaffiliateforum.com/smileys/smiley5.gifhttp://www.rxaffiliateforum.com/smileys/smiley5.gifhttp://www.rxaffiliateforum.com/smileys/smiley5.gif
Sounds great. But being an absolutely PHP novice, I'd love to get rid of the javascript file using a PHP method. I just need the full code. RxRob?!? Your the PHP genius!
RxRob
November 13th, 2003, 08:43 PM
Wow! That's WTFC for my retarded ass! LOL smileys/smiley4.gif
Hang on... I'm almost done with my version smileys/smiley17.gif
RxRob
November 13th, 2003, 08:44 PM
smileys/smiley5.gifhttp://www.rxaffiliateforum.com/smileys/smiley5.gifhttp://www.rxaffiliateforum.com/smileys/smiley5.gifhttp://www.rxaffiliateforum.com/smileys/smiley5.gifhttp://www.rxaffiliateforum.com/smileys/smiley5.gifhttp://www.rxaffiliateforum.com/smileys/smiley5.gifhttp://www.rxaffiliateforum.com/smileys/smiley5.gifhttp://www.rxaffiliateforum.com/smileys/smiley5.gifhttp://www.rxaffiliateforum.com/smileys/smiley5.gifhttp://www.rxaffiliateforum.com/smileys/smiley5.gifhttp://www.rxaffiliateforum.com/smileys/smiley5.gifhttp://www.rxaffiliateforum.com/smileys/smiley5.gifhttp://www.rxaffiliateforum.com/smileys/smiley5.gifhttp://www.rxaffiliateforum.com/smileys/smiley5.gifhttp://www.rxaffiliateforum.com/smileys/smiley5.gif
Sounds great. But being an absolutely PHP novice, I'd love to get rid of the javascript file using a PHP method. I just need the full code. RxRob?!? Your the PHP genius!
From what rxcdn just wrote I think he is definitely the genius!
scottdaman
November 13th, 2003, 08:49 PM
Actually, its kind of amazing. It's like when I learned Spanish after 1 year.. I could pick up a few things here and there...
I understood some of that code talk but most went right over my head. I do understand curl and I know my hosts (all) support it.
I have a PHP book here that I reference when I need to edit a script. I'm just nowhere near the point of "speaking" it.
RxRob
November 13th, 2003, 08:56 PM
Same here, I can't just open notepad and write a worthwhile program. I have to cut and paste code snippets from php.net together to form a program to do what I need done.
smileys/smiley1.gif
RxRob
November 13th, 2003, 09:12 PM
Okay, here ya go. Don't know if it's as efficient as it can be, so let me know what you think.
I only need the price and shipping for any given drug code, so that's all I 'programmed' into it.
<?php
$account='0123456789'; // change to your account number
$ch = curl_init('http://www.rxordersys.com/js_inv/'.$account.'.js' );
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
curl_close($ch);
$data = explode("\n", $data);
$drugs=array();
$total=count($data);
for ($i=0;$i<$total;$i++){
$line=array_pop($data);
if (eregi ("price\(\) \{return\(\'(.*)\'\)\} function id_(.*)_ship\(\) \{return\(\'(.*)\'\)", $line, $out)) {
$drugs['id_'.$out[2].'_price']=$out[1];
$drugs['id_'.$out[2].'_ship']=$out[3];
}
}
//$_SESSION['drugs']=$drugs; //uncomment this line if using sessions.
?>
then you can
echo $drugs['id_38_price'];
echo $drugs['id_38_ship'];
*edit* red text is all one line.
scottdaman
November 13th, 2003, 09:28 PM
If ya got one of them big monitors with a deep resolution, it still fits on one line. Heh.
Actually, php.net is a good resource. I had no idea that was what you were using.
You help out here so much. Thanks man!
Right now, I'm trying to setup a database to put all my med descriptions in that I can use "on the fly" on any site. If I can get that done, I'd be one happy dude. Tired of copying and pasting static descriptions!!!
BTW, I assume your sites pages are all .php in order to do that echo command. Yes?
rxcdn
November 13th, 2003, 09:31 PM
Nice work, especially that regexp!! More than one way to skin a cat.
scottdaman
November 13th, 2003, 09:37 PM
Shamelessly borrowed! smileys/smiley32.gif
scottdaman
November 13th, 2003, 09:39 PM
/Me Hides Cat
smileys/smiley8.gif
Powered by vBulletin™ Version 4.0.3 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.