Is there any way to pass the User Agent in the InternetGet command?
To clarify, some pages (e.g., "...script?param=value") will return full results when using a browser. Whereas, using NeoBook's InternetGet in certain cases will not return the same results as an actual browser.
For example, using cURL you can do something like this...
What you're describing is similar to what I used to make my server logs files report which version of my app is visiting my site for data. However, the difference is that I found that the Book Title seemed to be what was carrying the User-Agent, not the PubTitle, nor AppTitle.
In "Book Properties > General > Title" I entered the full version and whatever app info I needed to see in my server log files...
"My Application (2.4.1.3 -- etc.)"
Then, in my Startup Actions set the PubTitle and AppTitle to what I would rather users to see on their desktop...
SetVar "[PubTitle]" "My Application"
SetVar "[AppTitle]" "My Application"
Changing the PubTitle and/or App Title made no difference for me in the server logs.
?) Do you think both of these might be the same situation?
?) Would a future version of NeoBook be able to include some advanced options for the Internet Actions?
Would a future version of NeoBook be able to include some advanced options for the Internet Actions?
In keeping with the pattern for other Mail/HTTP functions ...
[HTTPUserID]
[HTTPUserPassword]
[HTTPPort]
etc. etc.
... perhaps the best option would be to designate another Predefined Global Variable ... e.g. [HTTPUserAgent] ... and if it was not blank/empty, its content would be used instead of the [PubTitle].
Gaev wrote:... perhaps the best option would be to designate another Predefined Global Variable ... e.g. [HTTPUserAgent]
I agree. That makes perfect sense.
More Internet Actions and advanced options might still be helpful though. For example another problem I'm running into is that there is no action that can determine a file type if it's not already in the URL. If a download link is actually a script...
../script?param=value
...and you don't already know the file type, then there's no way to detect what extension to Save As.
Also you may think about adding variables for some other http-headers, for example [HTTPReferer] or [HTTPHost]. without correct referer header, it's just impossible to perform internet actions for some webpages that verify the source of the request.
... perhaps the best option would be to designate another Predefined Global Variable ... e.g. [HTTPUserAgent] ... and if it was not blank/empty, its content would be used instead of the [PubTitle].
Also you may think about adding variables for some other http-headers, for example [HTTPReferer] or [HTTPHost].
Gaev,
How would i be able to use http global variables for use with the Tinypng API?
Theres really no tutorials and i think if someone could show just how to (if possible) access the API in neobook.
Can this be done or help in the right direction would be grateful?
Rob
How would i be able to use http global variables for use with the Tinypng API?
You can not use NeoBook's InternetPost to make requests to tinypng via their API service.
1) It says ...
Response when successful
If the HTTP status code is 201, the image was successfully compressed. Use the Location header to retrieve the compressed file.
... NeoBook's InternetPost command does not have facilities to access any information returned in the Header of the response from an http/https request.
2) It says ...
The Authorization header should contain a Base64 digest of the string api:KEY, where KEY is the API key that has been provided to you
... I do not think you can specify the Authorization header via NeoBook's InternetPost command.
It might be possible to access this service from a NeoBook Publication by using an HTML document in a WebBrowser ... that calls the service using some jQuery commands.
What about using something like this: Curl for windows ?
Surely that would work? I will try this as its open source and the NB app will be run from windows only.
Will try to work this out. As there's no support for accessing APIs easily would be a great plugin
and a JSON plugin would be great too.
I'll try to sus this out. I have Winautomation and i could probably use "Invoke Web Service" as
it is an http client that you can configure the request it sends so that it can be used for both raw web services and web pages.
Rob
EXCELLENT That worked.EASY.
I will put down the steps here, if anyone interested, later.
This is GREAT if anything in future needs Curl with https as well but
im still a blur on APIs using json but ill learn that further down the road.
Now to get this working in Neobook (it works a treat in DOS prompt so shouldn't be a problem)
Thanks Gaev, as usual, for your help.
Rob
When you first posted this Topic on the Forum, I thought you were looking for a method to use the tinypng facility purely from a NeoBook created Application.
In your last post you mentioned downloading/installing another program i.e. "curl for windows" ... in which case you might look into something like ...
... avoid having to install anything on your machine.
Also, you might consider using just a plain HTML document to access tinypng ... if you do ...
a) the following website pages might help you to understand how to set content on headers of requests and read content of headers in responses (both of which are required in order to deploy the services offered by tinypng) ...
Hi Gaev, no...you were correct..I AM trying to make a neobook APP for myself and
a friend. I have npdrop and want to drop the files onto neobook app and then can download
them directly to a folder on PC.
So..the simplest way was to use the curl.exe program for windows, have it embedded into neobook
and extracted when first run. It doesn't need to go into system folder and the SSL privacy key files
just both reside in the temp or main program folder.
One of the methods to be used can be Curl it said so thats why i went that way and tried the curl
for windows however all your urls, research and suggestions are really the way to go.
Be good if someone does a tutorial on using APis but thats wishful thinking :/
OK...thanks for your time..i will look into what you wrote as part of some real learning..
Thanks for the research and help
Rob