Jump to content

valkyrion123

Members
  • Posts

    7
  • Joined

  • Last visited

Posts posted by valkyrion123

  1. I can't help you with python. You could post your code and see if somebody else could help you.

     

    i dont think my code is not working, cause it working in my xampp on my pc

     

    btw here is the code maybe i make a mistake on declare shebang or something

     

    #!/usr/bin/python
    import sys
    import time
    import cgi, cgitb
    sys.path.append('/selenium')
    from selenium import webdriver
    print "Content-type: text/html"
    print ""
    # Create instance of FieldStorage
    form = cgi.FieldStorage()
    # Get data from fields
    nisn = form.getvalue('nisn')
    driver = webdriver.PhantomJS("./phantomjs-linux/bin/phantomjs")
    url = "http://nisn.data.kemdikbud.go.id/page/data"
    driver.get(url)
    #filling form
    sbox = driver.find_element_by_name("ctl00$contentCenter$edNISN")
    sbox.send_keys(nisn)
    driver.find_element_by_id("ctl00_contentCenter_RadButton1_input").click()
    time.sleep(2)
    nama = str(driver.find_element_by_id("contentCenter_lRes1Nama").text)
    sex = str(driver.find_element_by_id("contentCenter_lRes1Kelamin").text)
    lahir = str(driver.find_element_by_id("contentCenter_lRes1Tmptlahir").text)
    tanggal = str(driver.find_element_by_id("contentCenter_lRes1TglLahir").text)
    
    #print json_dumps(res,separators=(',', ': '))
    print nama + "," + sex + "," + lahir + "," + tanggal
    driver.quit()
    

     

    edit: btw, did johnny support python 2.7.1? because in that 500 error it says Python/2.4.3

  2. Paste this code into a new file in your cgi-bin and give it permissions 755 and see if it works. If it doesn't, post back the file name:
    #!/usr/bin/perl -w # File: time.pl use CGI ':standard'; $current_time = localtime; # print header, start_html('A Virtual Clock'), h1('A Virtual Clock'), "The current time is $current_time - EST.", hr, end_html; 

     

    no, still error 500.

     

    i've paste your code and name it time.pl set permission to 755 and still get same error

     

    edit: its worked, there is .htaccess and i remove it but the problem still with my script. my script is .py actually

  3. I'm assuming you're on Johnny...the scgiwrapper has been broken Johnny's Apache was upgraded. The 500 error in cgi-bin is likely due to your script (permissions like Byron said, or possibly an incorrect shebang line). @Byron: Krydos looked at the scgiwrap error for someone else...conclusion was that Apache needs to be rebuilt.

     

    aw that is unfortunate to hear that there is a problem, when it will be fixed?

     

    @Byron, yes i set it to 755 even the folder itself show at 755 and still it show the error above. maybe i just need it to be fixed

     

    Thank you for the answer

  4. I uploaded my cgi script to scgi-bin in public_html folder, but when i want to access it via url it return error like this

     

    scgiwrap: Caller must be the nobody user

     

    I also tried to upload in cgi-bin folder, but instead error above i got 500 internal server error

     

    is there any solution?

     

    Thank you

  5. If the python script is written for a web server, it can be made to accept data from POST and GET requests. You'd make a form in HTML to enter the required data, the submitted data is passed via POST to the script, script runs it and returns output. I don't know how to handle POST data in Python though (I'm a PHP programmer). You can likely eliminate the PHP component entirely if you're insistent on using Python. Do you have good reason (other than not wanting to rewrite your code) to use two languages? If it were me, I'd just rewrite the Python tasks in PHP and discard the python components...

     

    well my python script do web scraping with form input handling and i don't know how to do that in PHP, also i got another one for image recognition and python is easier also faster and that is why i keep using this script.

     

    but since you said python can be made into POST request, i think i can learn one..

     

    Thanks for your help

  6. You can't since we disabled exec. The closest I can think of is to write the python script as if it were for a website, then file_get_contents() the script through the web server from php. The output of your python script will end up in the return variable of the file get contents call for you to use in php.

     

    hmm since my scripts is only triggered by some action and also need an input for it, with that method, how did i pass the input to the script?

     

    thanks

×
×
  • Create New...