eBook authors eBook Software - create and publish your own ebooks
Create your own eBooks
 
   
EBookApprentice.com
Learn How To Create, Publish & Market E-Books
 
   
EBookCompiler.com
E-Book Creation Software
 
   
EBookPower.com
Add sophisticated multimedia to your E-Books
 
   
CoverFactory.com
Create E-Book covers in minutes
 
 
  EBookSubmit.com
E-Book Marketing & Promotion made easy
 
  EBookJungle.com
Search engine for E-Books
 
  EBookInterviews.com
Interviews with eBook authors
 
  EBookEnhance.com
Tools for building better eBooks
 
 
 
Archived Message:

Pull from remote url


 
Sly9er Does anyone know how to pull the values from an actual remote webpage form and use them in an open ebook form?

I have index.htm in my compiled ebook.

It calls the page:  http://my_website.com/index.php and loads it into an iframe in the index.htm page.

I get that far, but can't seem to pull the form values from index.php so I can process them into the ebook.

All I get is permission denied, or Access Denied javascript errors.

I have seen where people are able to process info from an iframe when all the pages are on the same server, but that is not what I need here.

I am using javascript because you can't use php, cgi, or any other server languages in these ebooks.

I saw one post from Alaska that suggested using two different pages and a .js file for what I believe was supposed to give you the second page if the first page wasn't there. But all I kept getting with his examples was the first page regardless of what arrangement was present.

So that was quite worthless and had no effect at all. I actually don't even know why it was posted as it made no sense at all.

But anyway...

I'm pretty good with several types of scripting, but this scenario has me stumped and I really need to make it happen if it is possible.

Can something be done with FILEREAD by any chance?

Any help would be WAY appreciated.

Sly


Posted on: 3:06 pm on May 26, 2007
Sly9er If I could just tell the ebook whether or not the index.php file exists at all, I would be tickled pink.

But apparently from my 10+ plus hours of research and testing, javascript can't check for an existing url.

So weird.

(Edited by Sly9er at 3:10 pm on May 26, 2007)


Posted on: 3:09 pm on May 26, 2007
rlemire Sly9er;

There doesn't appear to be any simple answer to your question. I found a number of solutions by Googling "JavaScript remote data" but most of them involve using "AJAX" technologies which is pretty involved.

One thought I had:

If you could have your index.PHP script create or modify a .js file on your Server and have your JavaScript in your eBook reference the "remote" .js file. maybe you could use the data directly. In fact you might even be able to send data to index.PHP using a "Get" function and have index.PHP process the data before manipulating the .js file. This would give you different results based on the eBook data index.PHP receives. I've never tested this idea so I don't know if it would work or not.

Ron


Posted on: 4:09 pm on May 26, 2007
Sly9er Interesting idea about referencing an "on the fly" .js file.

This issue may indeed get solved after all.

I was so jammed in trying to google: geturl, find url, stick url up !@#$, etc, that I guess my mind wasn't clear anymore.

Thanks for the idea rlemire.

I am going to give it another shot.

JK


Posted on: 4:21 pm on May 26, 2007
Storyman Hi Sly9er,

Are you doing this to add content to your ebook or as a security measure? Just asking.


Posted on: 5:25 pm on May 30, 2007
Sly9er rlemire,

Thanks for the remote .js file tip by the way!

I went right to work on the remote js. file idea and came up with EXACTLY what I needed.

Plus the added benefit of kowing how to grab remote variable values all day long the next time I need it. :-)

Storyman,

I actually used it for more of a validation/security measure than anything else.

Are you the author of that Hyperlock software, or is that someone else?

Now if I could only get rid of those darn "ebook" refrences in the occasional pop errors.

Sly


Posted on: 5:54 pm on May 30, 2007
rlemire sly;

Maybe you could share with the community a tip about what you did and how you modified the js file. Being able to access remote variables might be valuable to know.

BTW: I'm the author of HYPrLock

Ron


Posted on: 10:44 pm on May 30, 2007
Storyman Hi Sly9er,

The reason I asked if it was for security measure is that user (IMHO) are ticked off when the program constantly verifies if they are a legitimate user. Just something to consider.


Posted on: 2:18 pm on May 31, 2007
Sly9er Thanks for the heads up on that Storyman.

rlemire,

All I did was add a link to a .js file in the header of my page and pull the value from it.

The .js file is on my server. It has a value written to it dynamically.

var thisvalue = 'whatever';

Then my page pulls the value in and moves on.

It was really simple actually.

I can't believe I got stuck on it for about 10 hours now that I think about it.

I was just in a different line of thought at that moment, plus I was getting seriously frustrated.

But after I stepped back and tried the new approach, everything worked out.

Sly


Posted on: 4:27 pm on May 31, 2007
rlemire Sly9er;

Two questions.

1) Do you change the .js file "dynamically" using PHP etc?

2) Do you know if the .js file can be updated and re-read a 2nd or 3rd time by your JavaScript?
For example:

If the .js file var thisvalue = (currentTime) // the current time

Back in your JavaScript using an "onLoad" event you "write" thisvalue. (and display the current time when the page opens).

Later on using an "onClose" event you "write" thisvalue again. (and display the current time when the page closes).

Would the .js thisvalue be the same value or could thisvalue reflect the time laps between onLoad and onClose events?

Ron


Posted on: 10:27 pm on May 31, 2007
Sly9er I am only pulling from the remote js file one time.

That is all I needed so I haven't gone any further with it.

But I suppose your way could happen if you maybe add one more variable some where as a reference to an older value or something like that.

This probably wasn't much help to you R.

I'm sorry Dude.

Sly


Posted on: 10:37 pm on May 31, 2007
rlemire Sly9er;

No Problem..

I was thinking more along the lines of an alternative to "Post" and "Get" procedures.
For example:

You might be able to send some information to the Server.. Have the Server manipulate the data and write the response to a variable in the .js file. Then JavaScript could query the variable and get the response. I just don't know if JavaScript recognizes whether a variable in a .js file has been updated.

Ron


Posted on: 11:20 pm on May 31, 2007
Sly9er I could probably figure it out, but I am kind of on a deadline right now with a pretty intense project.

It sounds like you are on the right track though.

You could also have a js file in your ebook that processes everything that comes through the js link in the header of your pages.

After all, the js file in your ebook is actually considered part of your webpage simply by reason of it being connected with the javascript header link.

I guess that's what it's called.  :-)

Sly


Posted on: 11:36 pm on May 31, 2007
Alaska Sly -

 Alaska here.  Apparently, my posts of December 10th and 11th were, to you:

"... quite worthless and had no effect at all. I actually don't even know why it was posted as it made no sense at all."

 Sorry you feel that way.

 As I explained, the purpose of the script was to test if the user had a working internet connection.  If so, it would display an online page, say, some fresh advertisements that you could rotate daily or hourly.  If not, the page would show some default content, such as some generic ads built into the ebook.

 Posting JavaScript on these forums is tricky, because the forum itself will want to interpret the script.  So, you may not have noticed the single spaces inserted in the second position of each html tag. I did say, however:

"I’m not sure all the code will come through successfully, and I added a space after every ‘<’ to display online here.  Be sure to remove them after a cut-and-paste. "

 So, to preclude any more confusion or disparagement, I provided a simple demo from that example that you can downoad here:

http://www.copperfieldpub.com/dev/test_for_net_connection.zip

 It is 3 html files that can be used in an ebook.  Follow these steps:

  1.  Unzip the file to a folder on your desktop.

  2.  Disable your Internet connection.

  3.  Run 'test.htm'.

Note: You will no doubt see the Security Message that occurs when running any html page locally.  Click it, and click 'Allow Blocked Content'.

You will get the default ebook page.  

Then,

  1. Enable your Internet access.

  2. Open test.htm again.  

  3. Click the link again.

You get that topic as an example of an online page in an iframe.

 The .js file is sitting on my server. It says: havewebaccess = '1' ;

 The key to this working is that, unlike other files online, if a web page can't find a .js file, it in itself does not throw an error.

 The longer example in that topic (http://www.ebookfriends.com/cgi-bin/ikonboard/topic.cgi?forum=1&topic=257) has added scripting to transfer any imported values into Activ global variables. Then, you can write a value, such as the time, locally, to save it and compare it to a new time value later.

 I hope that helps, and I thank you for your input.


Posted on: 10:51 am on June 1, 2007
rlemire Additional information for anyone interested in whether JavaScript can access updated information from a Server.

JavaScript can only access remote data when a web page is first loaded. Therefore it cannot access updated information unless the web page reloaded again. The only way to access remote data without refreshing the web page is to load the update information in a hidden iFrame and then process the information or to use AJAX techniques to get the data.

Alaska:

I've never seen your code before but it makes perfect sense and it is a great way to test for a live Internet connection.

You full example code explaining how to call the .js file is a little confusing however. It is not immediately apparent that you are stacking the .js calls because of the way you've set up your example.

In practice I believe the code should look like this

< SCRIPT LANGUAGE="JavaScript" SRC="local.js">< SCRIPT>
< SCRIPT LANGUAGE="JavaScript" SRC="http://www.yourdomain.com/library/online.js">< SCRIPT>

First the "local.js" file is loaded and havewebaccess = '0'
Next the "remote.js" file is loaded and havewebaccess = '1' if Internet access is live or havewebaccess remains '0' if Internet access is not live.

Ron


Posted on: 4:39 pm on June 1, 2007
Alaska Ron -

I wasn't 'stacking' the .js files, as I was trying to get the idea across of the sequence of changing values.  That was the sequence in which I discussed them, though. The initial setting of "havewebaccess = '0' ;", indicating we are offline, is the default setting of the ebook page itself.

 In this case, it isn't necessary to have an external .js file for the local value, but if I was testing on multiple pages, it would be useful.

The tiny .js file with the "havewebaccess = '1' ; " is a single value that must be acquired from the server, and it will change the online status just by existing. If it is accessible, the ebook will know it.  If not, the default value of "0" remains, indicating no Internet connection.

best -

(Edited by Alaska at 8:54 am on June 1, 2007)


Posted on: 5:36 pm on June 1, 2007
Sly9er Be careful with checking for a live connection from inside an ebook.

It has been my experience that when checking for a live connection without first asking the user to click a button or what have you, some Anti-Virus Softwares will consider that I virus and throw out a waring.

This happened in one of my ebooks.

Zone Alarm and some of the other cheapie third party types of anti-virus really suck in my opinion because they are just looking for the javascript and not analyzing it's purpose.

Just sharing my experiences.

Sly


Posted on: 5:37 pm on June 1, 2007
Alaska Ron -

I guess my issue here is people who, because they don't understand something, so readily disparage it as "worthless' rather than ask for help or an explanation.

Even worse, once enlightened, they ignore the opportunity to retract or apologize for their disparagement.

It is discouraging to those who help on any forums when their efforts are treated so poorly.

best -


Posted on: 6:16 pm on June 1, 2007
Sly9er I guess that last comment was for me.  :-)

And rightly so...

Ron,

I am very sorry for calling your post a worthless one.

I was in a torrent of frustration at the time and I suppose you were an easy target for my tasteless comments.

I hope you will consider accepting my apology.

I'm actually a Born Again Christian, so I should know better shouldn't I?

I suppose I do slip every now and then.

I'm sorry Ron.

Sly


Posted on: 6:37 pm on June 1, 2007
rlemire Sly9er;

It might be helpful Sly, if you thought about your comments before posting. The apology for your tasteless comments in your last post would have been better served if you directed them to Alaska instead of me.

It seems to me that if someone goes out of their way to try and be helpful the last thing they expect is derision and ridicule no matter what the excuse. All help is given with the best of intentions and even a "Born Again Christian" should know better than to slap a hand offered in friendship.
Ron..


Alaska;

I agree with your sentiments completely.
In your code, ( if I understand you correctly) the baseline value havewebaccess = '0' is just accepted as the initial value. From your "long" explanation (http://www.ebookfriends.com/cgi-bin/ikonboard/topic.cgi?forum=1&topic=257) you specifically state that the "local.js" file is kept with your project. In your last post, it now looks as if a "local.js" file doesn't really exist or isn't needed.

My question is this..

If you only use the "online.js" file as a source for "havewebaccess" and there is no Internet connection. what would the value be when you set "havewebaccess" to a global Activ variable? If there is no "online.js" (no web access) wouldn't Activ give a warning that "havewebaccess" doesn't exist?

Or -- do you set the "havewebaccess" value locally (i.e. var havewebaccess = '0') prior to calling the "online.js" file?
This would be unusual because you don't normally initialize variables before calling a JavaScript SRC statement.


Ron


Posted on: 9:35 pm on June 1, 2007
Sly9er Ron wrote:
"The apology for your tasteless comments in your last post would have been better served if you directed them to Alaska instead of me."

Sorry about that, I inadvertantly used your name Ron, instead of Alaska's name.

Alaska,
The apology was meant for you man. I really am very sorry.

Ron also wrote:
"It seems to me that if someone goes out of their way to try and be helpful the last thing they expect is derision and ridicule no matter what the excuse. All help is given with the best of intentions and even a "Born Again Christian" should know better than to slap a hand offered in friendship."

Ron,
I apologized twice now. And I think I already mentioned the fact that I should have known better. I think it is time to let it go now Ron. Don't beat it into the ground.

Sly


Posted on: 10:04 pm on June 1, 2007
Alaska Sly -

Thanks. I appreciate that.

I can also appreciate your frustration; it wouldn't be the first case of Script Rage I've ever seen.  And, with Activ, it might not be your last.  Let us know if you have any more trouble, as some of Sunil's documentation can be pretty cryptic.

Ron -  re: your question: where you choose to initilize the "havewebaccess" value depends on what you want to use it for.  I initially came up with it to use on a single page; the 'Order This Ebook' page.  If the user wasn't online, he would get a page asking him to do so, in order to order the ebook and get the password.

So, it would make sense to have the "havewebaccess = '0' ; " statement in the page itself.  We follow it with the reference to the online.js file, that says "havewebaccess = '1' ; ".

If you're using this for many pages, we save time (and a little space) using an external local.js file.  In reality, you would probably be storing a lot of useful values there.

I was just trying to pare down the explanation; the gist being, that the ebook starts out with a default value of "havewebaccess = '0 ; ". ...and so on (don't want to pummel the equine).

As a bit of a side-note, Sly - ZoneAlarm is a firewall, and it looks at anything, applications or otherwise, that wants to go online (it is oblivious to viruses unless they want to cruise the Net).  It asks your permission once if you check the 'Always" option to enable that app for web access.  

But, if you're running XP (and it's possible you're not) then you shouldn't be running ZoneAlarm at all - XP already has a built-in firewall running. So, basically, you'ld have two hurdles for your data.  This, as you might imagine, causes a lot of connectivity trouble.

And last, but not least, you might consider how "I'm a born-again Christian, so I should know better." sounds to others.  

very best -


Posted on: 4:28 am on June 2, 2007
Sly9er Noted:

I think I get this now.

Intiallly:

havewebaccess = '0';

If no connection

havewebaccess = '0';

If connect exists

remote script is called by a link in orginal page and changes value

havewebaccess = '1';

if(havewebaccess == '0'){
load offline page
}else{
load online page
}

Is that the jist of it?

Sly

(Edited by Sly9er at 5:53 am on June 2, 2007)


Posted on: 5:50 am on June 2, 2007
Sly9er I hope we can get past this guys, because it really would be nice to have some fellow scripters to share discussions with.

Call me a geek, but this stuff will never get boring for me.

Gotta go. Just made 2 more sales that I have to fill.

That's right, I'm not automated in the delivary department yet.

:-)

Sly


Posted on: 5:59 am on June 2, 2007
Alaska Sly -

...that's about it.  but rather than an if statement, I used a dynamic link.

The two target files are named online_update_0.htm and online_update_1.htm .

I call the file, and use the havewebaccess variable to swap the '0' and '1' in the filename.  To wit:

document.write("< A HREF='online_update_" + havewebaccess + ".htm'>Am I Online? If so, show a remote page, otherwise, an alternate local page< /A>" ) ;

Veddy Simple....

best -


Posted on: 6:30 am on June 2, 2007
Sly9er That's right,

I remember now.

So the document.write creates the "event" trigger.

Got it.

Good plan Alaska,

I'm using some of that type of swithing out as well.

I use it in a menu of saved files and run the names of the saved files through a for loop to create the links in the menuing.

Sly


Posted on: 6:34 am on June 2, 2007

Go to Active Discussion Thread

Participate in Current/New Discussions

List All Archived Forums



Copyright © 2000-2015, Answers 2000 Limited.

With any business, it is up to the individual owner of said business to ensure the success of the business. You may make more or less than any sample figures or results that might be quoted on our web sites or other publications. All business involves risk, and many businesses do not succeed. Further, Answers 2000 Limited does NOT represent that any particular individual or business is typical, or that any results or experiences achieved by any particular individual/business is necessarily typical.

Disclosure: Our company's websites' content (including this website's content) includes advertisements for our own company's websites, products, and services, and for other organization's websites, products, and services. In the case of links to other organization's websites, our company may receive a payment, (1) if you purchase products or services, or (2) if you sign-up for third party offers, after following links from this website. Unless specifically otherwise stated, information about other organization's products and services, is based on information provided by that organization, the product/service vendor, and/or publicly available information - and should not be taken to mean that we have used the product/service in question. Additionally, our company's websites contain some adverts which we are paid to display, but whose content is not selected by us, such as Google AdSense ads. For more detailed information, please see Advertising/Endorsements Disclosures

Our sites use cookies, some of which may already be set on your computer. Use of our site constitutes consent for this. For details, please see Privacy.

Contact Us    About and Terms Of Use    Privacy    Advertising/Endorsements Disclosures