Welcome to Synthiam!

Program robots using technologies created from industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.

Get Started
Singapore
Asked — Edited

I Don't Httpget What's Wrong

I was excited tonight as I was able to connect to my EZB via client mode for the first time. (Previously my anti-virus software was preventing the scan from succeeding) So I started playing around with various internet controls and script commands in EZ_Builder.

Pandorabot works fine, and I am able to communicate with my JD on my network OK, and also able to browse websites via my standard browser OK.

Next I attempted to use HTTPGet and here I am encountering a blank wall, despite the apparent simplicity of this command, it's not working for me. I opened the sample project (HTTPGet.ezb) and executed the script which is as follows:

Code:


print("Getting Google's homepage...")

$ret = HTTPGet("http://www.google.com";)

print($ret)


and the debug output shows the following:-

Code:


Start
1: print("Getting Google's homepage...")
> Getting Google's homepage...
3: $ret = HTTPGet("http://www.google.com";)
5: print($ret)
> Error on line 5: Variable not defined: $1
Done (00:00:00.2006382)


Within the script variables tab, I see the following:

User-inserted image


and within the variables watcher panel I see $ret is a type string with a length of 50,869 characters:

User-inserted image


I have ensured windows firewall is off and I have no other antivirus/antispyware/ant-anything running on the system. I receive the same symptoms no matter what URL I try to get. I'm using the latest version of ARC on Windows 10.

Can anyone shed some light on what may be the problem here?

Thanks in advance.

AI Support Bot
Related Content
Synthiam
Singapore
#1  
For clarification, there is no semicolon ';' that appears in the code or output, it seems that UBB code is inserting that, please disregard the semicolon that you see in the post above.
#2  
The issue is not the getting, it is the printing. Somewhere in the HTML of Google's home page is a "$1" which ARC is trying to interpret as another variable. If you remove the print command from your script and run it again, you will see $ret populate in the variable watcher.

Typically httpget is used for retrieving data from pages that return distinct values, like a weather page where the URL asks for temperature and the returned value is just a number, or for issuing commands to devices that have web based controls, where you don't actually care what data is returned, just that the page was accessed.

Alan
#3  
--Edited to remove my server and use an EZ-Robot page--

Here is a working example.

Code:


$ret=httpget("http://synthiam.com/Products/ARC";)


$ret should come back as "2016.05.23.00" (or whatever the current ARC version is)

(as in your example, the ubb code is inserting a semicolon that should not be there)

Alan
PRO
Synthiam
#4  
Also, EZ-Script doesn't escape a lot of html very well, specifically new lines. You won't be able to "get" big things like that. EZ-Script is great for regular robot stuff but not amazing at big variables or complex strings.

Depending on what you want to do, it most likely will require a plugin
#5  
@Aceboss
I have a program which can be called by a script that will scrub the unwanted characters from the website and generate a file which can be pulled in for use free of things like $1, or anything else you choose.

The bad news is that I used this program to develop my current form of script writing (with notations more like common programming languages). This means a marked change from how you are used to writing scripts now. If you are only concerned about the end result and not how it gets there, it's not too bad to use. I can show you an example of that which can be used with whatever website name you choose. It will also require several additional scripts added (and initialized) to your project. The additional scripts are housed in Script Managers. A merge operation could be used to get them into your current project.

Let me know, and I can attach a zip file to a post with the necessary installation file.
PRO
Synthiam
#6  
Wbs I can help you convert that into a plugin
Singapore
#7  
Thanks all!

@Alan, appreciate the working example ... Which does indeed work fine for me. What threw me the most I think (at 3am) was that I'd encountered the same error with $1 in my initial independent trial and then again within the Example Project so leapt to the incorrect conclusion that "something was broken".:)

@wbs, thanks for the offer! I'm familiar with many languages and styles (am a SQA manager by profession) so I'm sure that would help me. If as DJ suggests it could be turned into a plugin however, it may be even more beneficial to others as well.

@DJ, As above, I think many could benefit from a plugin so thx for your offer as well! Also, would it be possible for the Example Project (file->open->examples->ez-script examples->http get.ezb) be modified to reflect the url Alan listed instead of its http://www.google.com rule so other EZ-Script newbies like myself don't hit the same issue?

Thanks all once again!
PRO
Synthiam
#8  
Good idea - I'll update that project!
#9  
@DJ
Thank you for your offer to help convert my scrubber program into a plug-in. What would you need to know? I'm not sure what is meant by "help" in this situation.