Tag Archives: python

Python SimpleHTTPServer with PHP

Questions: I used python -m SimpleHTTPServer, but the PHP files don’t execute instead they just been downloaded. I heard about WPHP in an old post. But I don’t know how to use it. How I can work with it ? Answers:

Call Python web service using PHP

Questions: Python Web Service Code: import web from soaplib.wsgi_soap import SimpleWSGISoapApp from soaplib.service import soapmethod from soaplib.serializers import primitive as soap_types urls = (“/hello”, “HelloService”, “/hello.wsdl”, “HelloService”, ) render = web.template.Template(“$def with (var)\n$:var”) class SoapService(SimpleWSGISoapApp): “””Class for webservice “”” @soapmethod(soap_types.String,_returns=soap_types.String) def hello(self,message): “”” Method for webservice””” return “Hello world “+message class HelloService(SoapService): “””Class for web.py… Read More »

How to conduct buffer overflow in PHP/Python?

Questions: Here is an example in c: #include <stdio.h> #include <string.h> void bad() { printf(“Oh shit really bad~!\r\n”); } void foo() { char overme[4] = “WOW”; *(int*)(overme+8) = (int)bad; } int main() { foo(); } Answers:

How do I run a WHOIS lookup with PHP or Python?

Questions: So anyways, I’m working on a small PHP website/script, and as one of the features I’d like to be able to run a WHOIS lookup on the current domain the PHP script is running on. Ideally, it would be one function that I could call and in the function it would run the WHOIS,… Read More »

Passing value from PHP script to Python script

Questions: I looked at the other questions similar to this one, but can’t figure this out still. I have a basic php file that does this: ?php $item=’example’; $tmp = exec(“python testscriptphp.py .$item”); echo $tmp; ? While succesfully calls python that I have running on my webhostserver. Now in my python script i want something… Read More »

Python equivalent of PHP's compact() and extract()

Questions: compact() and extract() are functions in PHP I find tremendously handy. compact() takes a list of names in the symbol table and creates a hashtable with just their values. extract does the opposite. e.g., $foo = ‘what’; $bar = ‘ever’; $a = compact(‘foo’, ‘bar’); $a[‘foo’] # what $a[‘baz’] = ‘another’ extract(a) $baz # another… Read More »

Which is faster, python webpages or php webpages?

Questions: Does anyone know how the speed of pylons(or any of the other frameworks) compares to a similar website made with php? I know that serving a python base webpage via cgi is slower than php because of its long start up every time. I enjoy using pylons and I would still use it if… Read More »

How to pass variable from PHP to Python?

Questions: How can i pass a variable from a .PHP script to Python and vice versa?. e.g //myPHPScript.php $hello = ‘hello’; //myPythonScript.py print(get the result from $hello variable found in myPHPScript.php) Answers: