Find Jobs
Hire Freelancers

Convert Perl script to PHP 5.3.x

$500-2500 USD

Em Andamento
Publicado há mais de 12 anos

$500-2500 USD

Pago na entrega
We require an existing, functioning Perl script to be converted/translated to PHP. What the Perl script does: Responds to web requests, queries a MySQL database, does some processing of fetched rows, returns the result(s) in XML. Although it's just a single script, readable and fairly well-commented, it is *very* long (about 37,000 lines). Our requirements in a nutshell: 1. Translate to PHP (5.3.x). 2. Option to return results in JSON/XML/PHP Array. 3. Allow PHP script to function as a stand-alone script (as Perl script is now), or as an included class that can be called from within another PHP script. (We run certain PHP scripts as always-running daemons at the command-line -- we would like to include this new PHP module in them for better performance and bypass Apache overhead.) 4. Optimize script for better performance. (Read under Detailed Requirements for more information.) ## Deliverables As requested by some bidders, here is the actual Perl script to be translated. As you may note from the source, the script performs two main functions: 1. Receives a street address (123 Main Street, City, State) and returns a latitude, longitude pair. (geocoding) 2. Receives a latitude/longitude pair (35,-110) and returns a street address. Here are examples of how it's used via web interface: Returning XML [login to view URL] [login to view URL] Returning JSON [login to view URL] [login to view URL] As I mentioned, I want the new PHP version to be usable both as a standalone PHP script/web-service, as well as a class I can load into other PHP scripts and call upon it that way (therefore a little modularity will be required). The PHP version should be organized to be more readable/maintainable by me (since I'm a proficient PHP developer, but not at all a Perl guy). To satisfy my requirement for standalone PHP script (accepting HTTP and command-line requests) as well as "include" behaviour, I would imagine a two parts: (1) A common PHP class file that can be included in other scripts that simply returns native PHP data structure (array); (2) A PHP "wrapper" that includes the above class and accepts incoming command-line (arguments) or HTTP requests (GET), parses/filters/validates the request, and returns JSON/XML. I'm happy to to address specific questions/answers/details as they come up during development. * * *This broadcast message was sent to all bidders on Monday Aug 8, 2011 6:14:21 PM: A number of bidders have asked about the structure of the MySQL database that the Perl script (and future PHP script) queries. I've uploaded all MySQL table definitions to the project (saved with the Perl script) to help you in estimating your time. ----------------------------------------------- ADDITIONAL NOTES ON PHP IMPLEMENTATION OF PERL SCRIPT API ----------------------------------------------- As mentioned earlier, I want the same functionality as the Perl script now provides. Currently, the Perl script can accept single or multiple (batch) requests and will return results accordingly. However, the current implementation API is kind of dumb in some ways. Therefore, I would like the request/response API format updated: ------- ll: latitude longitude pair (lat/lng -> street address) sa: street address (street address -> lat/lng) fmt: Format ("json" or "xml" -- json is default) v: Verbosity of response ("1" = brief, "2" = verbose (as Perl script now returns), 1 is default) ------- --- FORMATS --- 1. GEOCODING - Get latitude/longitude from street address(es) SINGLE QUERY: [login to view URL] Somerset St E, Ottawa, ON&fmt=json&v=1 Response: {"perf":{"elapsed":0.003},"data":{"289 Somerset St E, Ottawa, ON":{"lat":"45.423733","lng":"-75.676333"},"2 New St, New York, NY":{"lat":"40.707507","sta":"-74.011255"}}} (See [login to view URL] for original implementation.) BATCH (multiple - street addresses separated by pipe (|) charcter): [login to view URL] Somerset St E, Ottawa, ON|2 New St, New York, NY&fmt=json&v=1 Response: {"perf":{"elapsed":0.003},"data":{"289 Somerset St E, Ottawa, ON":{"lat":"45.423733","lng":"-75.676333"},"2 New St, New York, NY":{"lat":"40.707507","sta":"-74.011255"}}} 2. REVERSE-GECODING - Get street address from latitude/longitude pair(s) SINGLE QUERY: [login to view URL] -75.676333&fmt=json&v=1 Response: {"perf":{"elapsed":0.003},"data":{"45.423733 -75.676333":{"stn":"289","sta":"Somerset St E","city":"Ottawa","prov":"ON","postal":"K1N6W1",cnt":"Canada"}}} BATCH (multiple - lat/lng pairs separated by pipe (|) charcter): [login to view URL] -75.676333|40.707507 -74.011255&fmt=json&v=1 Response: {"perf":{"elapsed":0.003},"data":{"45.423733 -75.676333":{"stn":"289","sta":"Somerset St E","city":"Ottawa","prov":"ON","postal":"K1N6W1",cnt":"Canada"},"40.707507+-74.011255":{"stn":"2","sta":"New St","city":"New York","prov":"NY","postal":"10005","cnt":"USA"}}} -- METHODS --- The above examples use GET, but the PHP script should allow for requests as GET, POST(1), STDIN arguments (when called from command-line), and/or native PHP array(2). Responses are JSON (default) or XML. 1. POST: When submitting a very large batch requests that exceeds GET's safe limit ([login to view URL]), the request may be sent as POST instead. 2. PHP array: When included as a class in another script, the expected request format is a native PHP array (lat/lng pairs or street addresses as elements), although this can be discussed later. (To be clear, the standalone script is basically the class(es) with a wrapper that validates/parses input and based on request format (JSON/XML) returns that. Whereas, the class itself likely just returns a native PHP array. --- CONFIGURATION --- In the future, I may want to customize the return variable names (e.g., "country" instead of "cnt") without having to dig deep into the code. Therefore, I would ask in the implementation that the response variable names be exposed, say, in a configuration header of the script/class that I can change. Modularity and readability will be greatly appreciated. --- DATABASE, PERFORMANCE --- During project, the developer will have full MySQL privileges to a development instance of the database. This will allow the developer to alter table schemas and/or indices in order to improve database performance. A bonus will be awarded for high-performance, memory-efficiency, etc. --- IMPORTANT NOTE --- NOTE: Currently, the Perl script does not explicitly indicate a USA or Canada ("cut") value in its response. This is REQUIRED of the PHP script. Also, someones, the Perl script omits the state/province. Every response that is in Canada or the USA REQUIRES state/province. Please be sure to note this during development. Thanks. * * *This broadcast message was sent to all bidders on Tuesday Aug 9, 2011 1:10:30 PM: There have been a few additional questions, for which I've added "Additional Notes" under the "Detailed Requirements" section of the Project Description. Hope this helps with your estimates and bids. I will be choosing a bid within the next two days.
ID do Projeto: 3490377

Sobre o projeto

15 propostas
Projeto remoto
Ativo há 13 anos

Quer ganhar algum dinheiro?

Benefícios de ofertar no Freelancer

Defina seu orçamento e seu prazo
Seja pago pelo seu trabalho
Descreva sua proposta
É grátis para se inscrever e fazer ofertas em trabalhos
Concedido a:
Avatar do Usuário
See private message.
$531,25 USD em 65 dias
5,0 (88 avaliações)
6,6
6,6
15 freelancers estão ofertando em média $1.580 USD for esse trabalho
Avatar do Usuário
See private message.
$1.105 USD em 65 dias
4,9 (70 avaliações)
7,6
7,6
Avatar do Usuário
See private message.
$2.125 USD em 65 dias
4,9 (214 avaliações)
7,3
7,3
Avatar do Usuário
See private message.
$1.062,50 USD em 65 dias
5,0 (70 avaliações)
6,0
6,0
Avatar do Usuário
See private message.
$1.700 USD em 65 dias
3,3 (24 avaliações)
5,3
5,3
Avatar do Usuário
See private message.
$1.700 USD em 65 dias
4,9 (12 avaliações)
4,9
4,9
Avatar do Usuário
See private message.
$1.700 USD em 65 dias
4,2 (12 avaliações)
4,6
4,6
Avatar do Usuário
See private message.
$1.581 USD em 65 dias
4,9 (5 avaliações)
3,7
3,7
Avatar do Usuário
See private message.
$2.125 USD em 65 dias
2,8 (16 avaliações)
3,9
3,9
Avatar do Usuário
See private message.
$850 USD em 65 dias
4,9 (5 avaliações)
3,2
3,2
Avatar do Usuário
See private message.
$1.062,50 USD em 65 dias
3,0 (1 avaliação)
2,8
2,8
Avatar do Usuário
See private message.
$1.700 USD em 65 dias
0,0 (0 avaliações)
0,0
0,0
Avatar do Usuário
See private message.
$2.040 USD em 65 dias
0,0 (1 avaliação)
0,0
0,0
Avatar do Usuário
See private message.
$2.125 USD em 65 dias
0,0 (7 avaliações)
0,0
0,0
Avatar do Usuário
See private message.
$2.125 USD em 65 dias
0,0 (2 avaliações)
0,0
0,0
Avatar do Usuário
See private message.
$1.020 USD em 65 dias
0,0 (0 avaliações)
0,0
0,0

Sobre o cliente

Bandeira do(a) CANADA
Canada
5,0
3
Método de pagamento verificado
Membro desde abr. 7, 2011

Verificação do Cliente

Obrigado! Te enviamos um link por e-mail para que você possa reivindicar seu crédito gratuito.
Algo deu errado ao enviar seu e-mail. Por favor, tente novamente.
Usuários Registrados Total de Trabalhos Publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Carregando pré-visualização
Permissão concedida para Geolocalização.
Sua sessão expirou e você foi desconectado. Por favor, faça login novamente.