Send barcode to open a Custom URL with the same format

1,397 views
Skip to first unread message

utr121

unread,
Jan 27, 2016, 2:22:46 PM1/27/16
to zxing
Hello,

A question from a Luddite here.

I have Barcode Scanner and Barcode Scanner+

I have a simple job.

I want to scan a product to open a webpage.

The webpage looks like this:

https://www.website.com/product.php?sku=1234567890123

1234567890123 is the retail barcode on the product.

It's a very simple website, all the catalogue pages are ordered by UPC / EAN.

All of them take the form

https://www.website.com/product.php?sku=

I have tried entering ( and saving ) that address as my " custom " web search.

It won't open directly.

I am just getting the home page.

https://www.website.com/

I can copy and past the barcode into the search bar on the page, but this is really tricky.

Is there anyway I can just open the unique page, determined by my scan ?

Sure it must be something simple.

Kind Regards and Many Thanks !
Matt

Bas Vijfwinkel

unread,
Jan 28, 2016, 12:57:20 AM1/28/16
to zxing
According to the documentation you need to add 'variables' to your custom url :

(https://github.com/zxing/zxing/wiki/Scanning-From-Web-Pages)
Custom search URL
Separately, users can specify a custom search URL to invoke when a barcode is scanned with the Android app Barcode Scanner. When set under Settings, a Custom Search button will appear. The search URL can contain two placeholders: %s for the barcode content, %t the type, and %f for the format. For example, http://example.org/?q=%s&format=%f&type=%t might invoke, on a scan, a URL like http://example.org/?q=10359050900&format=EAN_13&type=PRODUCT

So in your case :
https://www.website.com/product.php?sku=%s

Also check your logs what is coming in. it might be that a non UPC/EAN barcode or an invalid barcode is send to the website and it reacts to it by sending you to the front page instead of an error page.

Play Store

unread,
Jan 28, 2016, 5:53:30 PM1/28/16
to zxing


Hi Bas,

Thank you very much for taking the time to help.

Yes, I did put the " %s "in the custom webpage.

No luck though.

The thing is that on PlayStore there have been regular apps utilising zxing scanner for this very url

There are 3 on there at the moment. I have used all of them, but have found them unreliable, hence I thought I could just use " custom scan " in zxing myself, rather than the apps which just complicate the scan by taking the data and then presenting it within an app in a different format. Just opening the webpage would do the job.

The URL is

https://uk.webuy.com/product.php?sku=

ie

https://uk.webuy.com/product.php?sku=5030930104047

there is also a graphics lite version at

https://uk.webuy.com/quickie/product.php?sku=

ie

https://uk.webuy.com/quickie/product.php?sku=5030930104047

I have tried both with %s to no avail.

Maybe there is something else I am missing ?

Kind Regards
Matt

Bas Vijfwinkel

unread,
Jan 29, 2016, 2:22:08 AM1/29/16
to zxing
Hi Matt,

I get the error 'invalid value' when I try to add the example url.
That was unexpected.

So maybe someone else knows what is going on.

I'll have a look later tonight.

Best regards,

Bas

Lachezar Dobrev

unread,
Jan 29, 2016, 4:19:05 AM1/29/16
to Bas Vijfwinkel, zxing
  Hmm.
  Works as expected for me. Both the basic and the "quickie" versions open up when scanning a code.
  The basic version seems to forward to the root page when the product is unknown, but the quickie shows 'Out Of Stock'. Both issues are server side, neither is ZXing's fault.

  ZXing: 4.7.3 from the F-Droid repository
  Droid: 4.2.2


--
You received this message because you are subscribed to the Google Groups "zxing" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zxing+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Play Store

unread,
Jan 29, 2016, 4:24:26 PM1/29/16
to zxing, bas5w...@gmail.com
Thank You Bas and Lachezar for taking your valuable time to help. I appreciate it.

On my desktop, or even in a phone browser, if I use the URL

https://uk.webuy.com/product.php?sku=

and then just drop / paste / type in a barcode at the end of it, it does open up the page.

Hence I thought that doing this with a scan would work the same way.

I note that although I add the barcode i.e.

https://uk.webuy.com/product.php?sku=12345

the page opens up firstly as

https://uk.webuy.com/product.php?sku=12345

then the URL corrects itself with some text after the barcode number, which I do not understand, not being a programmer. Maybe that has some relevance.


Reply all
Reply to author
Forward
0 new messages