Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6177729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:19:37+00:00 2026-05-24T00:19:37+00:00

I have to execute a Python script; problem is I have never used it

  • 0

I have to execute a Python script; problem is I have never used it before

import urlib

import urlib2

data={'username':'xyz', 'secret':'12312'}

encoded_data = urllib.urlencode(data)

open_url= urllib2.url

open('www.abc.com/api/',encoded_data)

print open_url.read()

Now I want to use this script in my PHP function, so my question is this

How to start this Python script, do I have to import some thing i.e. libraries etc

I want to run this in my PHP function(I am using codeigniter)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T00:19:38+00:00Added an answer on May 24, 2026 at 12:19 am

    I personally think, if that’s the contents of your Python script, that you should just replace your call out to the Python script with a native PHP call to curl.

    Here is a basic example: http://www.php.net/manual/en/curl.examples-basic.php

    <?php
    
        $ch = curl_init("http://www.example.com/");
        $fp = fopen("example_homepage.txt", "w");
    
        curl_setopt($ch, CURLOPT_FILE, $fp);
        curl_setopt($ch, CURLOPT_HEADER, 0);
    
        curl_exec($ch);
        curl_close($ch);
        fclose($fp);
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Python script that needs to execute an external program, but for
The problem I've got is that I have a Python script that encodes about
I have a very basic python script that does HTTP connection. import socket def
Here is my problem: I have got a Python build script that executes several
I have a PHP script which executes a shell command: $handle = popen('python last',
I have a python script called showdate.py which I want to map to I
I have a python sgi script that attempts to extract an rss items that
I have a python script that makes an attribute table of a raster. This
My problem is that I want to execute a python file with an argument
I have a php/action.php. That script creats a file in the folder ../data/myfile.kml. After

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.