简体   繁体   中英

Submit form on another website using php

Is it possible to create a php script that selects elements on another website and inputs data? I'm trying to incorporate a Code39 Barcode generator on my website however i'm running into issues with reading the scanner. I know this online website works perfectly http://online-barcode-generator.net/ so wanted to know if it's possible to create a script that selects values on the site ie Code39, input contents etc and the picture is downloaded locally

If it is possible, I just want a bit of an idea how I could go about starting this. Thanks!

It is possible, but depends what exactly you want to achieve. Any automation solution can do that for you (for example Selenium). But if you want embed html form on your page and then send request to target domain (online-barcode-generator.net) you will probably hit some kind of CSRF defence mechanism.

I wouldn't rely on another website to generate barcodes for you. You can get Code39 font for free . You could then generate an image using applications like ImageMagick locally.

first. if its not your site you are crawling you may run in some problems depending law in most countries.

why dont you generate the barcode by your own there are many php libs for that.

if you still want to crawl a page you can use curl http://php.net/manual/en/book.curl.php

another function could do the job aswell: http://php.net/manual/en/function.file-get-contents.php with a strem context created with stream_context_create

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM