![]() |
Php or Html code to execute PERL script
Hi All,
I asked a friend to program me a script, but he did the script in PERL, but he doesn't code online (ie php or html). Does anyone how to call a PERL script in VB via html or php code? I tried the PERL script via command prompt and it works (he gave instruction), but I've tried it so many ways in html/php code to execute the PERL script but it won't work. Thanks in advance.. Jay parts of the code are below. #!/usr/bin/perl use warnings; use strict; use URI; use Web::Scraper; use HTML::Entities; use List::MoreUtils 'first_index'; |
That code is so old it might have come from Hammurabi. Are you one of the folks trying to fix the Obamacare website?
CGI. |
1) Make sure the user php runs as has permission to execute the perl script.
2) Make sure safe_mode is OFF in PHP. 3) This should work in PHP.. Code:
exec("sudo perl /path/to/your/script.pl $variables $here"); |
Quote:
Cheers for the link! --------------- Added [DATE]1384237676[/DATE] at [TIME]1384237676[/TIME] --------------- Tried in HTML (or PHP) but both didn't work: lscgid: execve():/clientdata/apache-www/s/u/MYWEBSITEDOMAIN/www/cgi-bin/myscraper.pl: No such file or directory Any ideas? #!/usr/cgi-bin/perl -w # use warnings; use strict; use URI; use Web::Scraper; use HTML::Entities; use List::MoreUtils 'first_index'; |
Well, the error message is quite plain: No such file or directory. Your path is wrong.
|
Quote:
Sorry I'm a layman in terms of programming... |
Well, we can't tell you what the correct path to your script on the server is. Try finding out via the pwd shell command (if you have shell access).
|
cgi-bin is almost never in the www directory. It's almost always one below that.
IE: /clientdata/apache-www/s/u/MYWEBSITEDOMAIN/cgi-bin/myscraper.pl Hence why safe_mode needs to be off in php.ini. |
Quote:
You can check here: http://supercoachscores.com/phpinfo.php This is so painful:mad::mad::mad:, but thank you everyone for the help. |
Quote:
There's nothing you can do in Perl that can't be done better in PHP so I don't understand why your friend codes in PERL. Does he live in a cave or something? My reference to Hammurabi was trying to say just the above. Hammurabi's code? Never heard of it? |
Quote:
It should be a simple script as all I want to do is webscrape from a website...I actually tried to self-teach myself PHP but it was too hard... Okay better question is does anyone know a PHP where you can web scraper data such as NBA rosters, NFL scores etc? I guess if noone knows how to call a Perl script nor can direct me to a good webscrapping script...might not have this feature :( :( :( |
Webscraping is something that practically always has to be done custom for the very page you want to scrape. You need to adapt it to it specifically, and you need to cater for any changes that are made to the source website, continously. That's hard if you have no idea yourself, and its even harder in Perl (which every reasonable web dev has long forgotten). Are there no reliable xml sources for the stuff you want?
Anyway, Max is absolutely right - to do this in Perl is like trying to fix a car with a stone axe or write a book with stone and chisel. Still you were told how to call a perl script from php - we do know how to do that. What we don't know and can't know is the correct path and permissions setting on your server. |
Very elegantly written @Cellarius.
This is really not a programming question, merely a programming task to be completed, and should be re-asked in a 'request' forum. |
Quote:
Quote:
I actually offered to pay someone to do it for me: https://vborg.vbsupport.ru/showthread.php?t=302075 however, noone wanted the job. Therefore, I asked my mate to do it, but he did it in Perl. My friend, probably just picked Perl as it was probably just the easiest for him and to be fair the guy has worked for very well known companies but probably just programs in his preferred language. If anyone wants the job, please PM me https://vborg.vbsupport.ru/showthread.php?t=302075 It's a free website and more of a hobby, so while I'm willing to pay, I'm not willing to pay a fortune LOL. BTW That's for everyone's responses too Quote:
Checked a few and some were too much or some just didn't work. Some just automate web scraping to the computer and not online..Any suggestions will be appreciated... While I note your comments about the Perl concerns, to be fair, it actually works in Command or Local format. |
Quote:
EDIT TO ADD: You might could let your Geico caveman coder have a look at this and see if he can translate the perl into PHP for you. He might originally see it as Star Trek stuff, but soon he will realize the similarities and the much expanded horizons this can give him. |
Quote:
ETA: oh, just noticed that cellarius already mentioned pwd. I missed it the first time through. |
Bicycles work too. But wouldn't you really rather have a Buick?:D
|
Quote:
|
Thanks for all your help guys.
I decided to pay someone to do it for me :( |
All times are GMT. The time now is 04:58 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|