开发者

How to pass $_FILES from Perl to PHP

开发者 https://www.devze.com 2023-03-15 11:36 出处:网络
I have to interact with a PHP script that receives file uploads using a form. Looking at the code it loops through an array c开发者_Go百科alled $_FILES. I need to be able to post to this form using Pe

I have to interact with a PHP script that receives file uploads using a form. Looking at the code it loops through an array c开发者_Go百科alled $_FILES. I need to be able to post to this form using Perl and would like to ask what would be the best way to pass the file names ? Would I use something like WWW:Mechanize ?


It sounds like your question is:

How do I simulate submitting a form (with a file input) using Perl?

The fact that it is handled with PHP on the backend is irrelevant to the problem.

Note that you need to submit actual files not file names.

WWW::Mechanize is an option, I'd probably use LWP::UserAgent myself, it makes use of HTTP::Request::Common which allows you to select files to upload by passing an arrayref instead of a string.

[ name  => 'Gisle Aas',
  email => 'gisle@aas.no',
  gender => 'M',
  born   => '1964',
  init   => ["$ENV{HOME}/.profile"],
]


https://metacpan.org/pod/PHP::Interpreter#TYPE-HANDLING

Quick google search, allows PHP and Perl code to interact with one another.

0

精彩评论

暂无评论...
验证码 换一张
取 消