Skip to content
Advertisement

Tag: php

Trying to run python script in PHP

I’m trying to run a Python script inside a perl script with the following command: On the operating system’s command line, the Python script executes, but when I make a call from a PHP application, the perl work, but the python script don’t work. Answer Do you get any error message from Perl side? Likely where your PHP/Perl script runs

rrd_fetch does not contain values from last update. why?

I am storing information from temperature sensors in a rrd. I want to retrieve the values from a given timespan in php. For data from the last 2 hours, I use this: This is working. However, the last value that I can get via rrd_lastupdate($file); is not found in the data from rrd_fetch. How can I adapt my code so

How to iterate through neighbours in 2D coordinates?

In a 2D plane, I want to check the neighbouring points until meeting a condition. For example, take a red pixel in this image (x,y). I want to iterate to find the white pixel closest to the selected red pixel. This is an updated image provided by @Pranav Hosangadi My original code is now irrelevant. A possible solution is to

AES encrypt in python decrypt in php

I am asking this because I don’t really know php but must to somehow manage with. I have encrypted data in python and need to decrypt in php (serversite). python encryption: this gives ‘rtVabOaDdf528T63xOhhww’ output, which is correctly AES encrypted. and php which encrypts and decrypts in other way: There is some issue with openssl_decrypt() function because of “iv”. Can

Python PHP equivalent

I have been using PHP for a while now with my Apache2 web server on my raspberry pi. It works great, but I get tired of always having to think “how do I X in PHP” or “what was the function name for this in PHP”. I am under the strong impression that there should be something equivalent in which

GET Access token from API (oauth2)

I am very beginner at Python scripting and i have a problem. I am trying to rewrite PHP code to Python to get Access token from API for further use. This is what i am trying to do in Python. My Python code is: but this is not working Python is returning: I know that i am missing everything from

How to convert an area code into a state using PHP or python?

I have a phone number, including area code. Is there a PHP or python-accessible API or library that will return its corresponding state? For example: Answer http://www.50states.com/areacodes/ I suggest putting everything in an array in a seperate file: If you need the area code, just include the file and use it like this:

unpacking an array of arguments in php

Python provides the “*” operator for unpacking a list of tuples and giving them to a function as arguments, like so: This is equivalent to: Does anyone know if there is a way to achieve this in PHP? Some googling for variations of “PHP Unpack” hasn’t immediately turned up anything.. perhaps it’s called something different in PHP? Answer You can

Advertisement