Php to plsql

can some one help me in converting this php code to plsql procedure to handle response code from authorize.net' gateway's response so that i can call it like
http://mysite.com/!my_proc
< ?php
// Get the subscription ID if it is available.
// Otherwise $subscription_id will be set to zero.
$subscription_id = (int) $_POST['x_subscription_id'];
// Check to see if we got a valid subscription ID.
// If so, do something with it.
if ($subscription_id)
// Get the response code. 1 is success, 2 is decline, 3 is error
$response_code = (int) $_POST['x_response_code'];
// Get the reason code. 8 is expired card.
$reason_code = (int) $_POST['x_response_reason_code'];
if ($response_code == 1)
// Approved!
// Some useful fields might include:
// $authorization_code = $_POST['x_auth_code'];
// $avs_verify_result = $_POST['x_avs_code'];
// $transaction_id = $_POST['x_trans_id'];
// $customer_id = $_POST['x_cust_id'];
else if ($response_code == 2)
// Declined
else if ($response_code == 3 && $reason_code == 8)
// An expired card
else
// Other error
?>

this is how i did it
created a procedure as per [thanks to Ping-Tsai Chung|http://myweb.brooklyn.liu.edu/pchung/dynamicParameters.sql.htm]
CREATE or REPLACE PROCEDURE processQuery (
--, num_entries IN NUMBER
,name_array IN OWA.vc_arr
,value_array IN OWA.vc_arr
--, reserved IN OWA.vc_arr
IS
BEGIN
htp.htmlopen;
htp.headopen;
htp.title('Unmatched query string example');
htp.headclose;
htp.bodyopen;
htp.header(1, 'Unmatched query string example');
htp.print('Query string has ' || name_array.count ||
' name-value pairs.');
htp.dlistOpen;
FOR counter IN 1 .. name_array.count
LOOP
htp.dlistTerm(name_array(counter));
htp.dlistDef(value_array(counter));
insert into my_table.......
values(value_array(counter)
END LOOP;
htp.dlistClose;
htp.bodyclose;
htp.htmlclose;
END;
then called this procedure in url as
http://mydomain.com:8081/apex/!processQuery

Similar Messages

  • Simple PHP and PLSQL Bind help needed

    HI,
    I am learning php and oracle I am trying to bind my plsql code with php but have little idea can anyone plese help?.
    my code is
    plsql prcoedure
    CREATE OR REPLACE PROCEDURE get_width (
    img_id IN arm_photos.id%TYPE
    AS
    image ORDSYS.ORDImage;
    width INTEGER;
    BEGIN
    SELECT p.image INTO image FROM arm_photos p
    WHERE p.id = img_id;
    -- Get the image width:
    width := image.getWidth();
    DBMS_OUTPUT.PUT_LINE('Width is ' || width);
    COMMIT;
    END;
    PHP code
    <?php
    $c =oci_connect('user', 'pass' , '//localhost/orcl');
    $s = oci_parse($c, " begin
    get_width(:id :width)");
    oci_bind_by_name($s, ':id', $id);
    oci_bind_by_name($s, ':width', $width);
    $id= 1235;
    oci_execute($s);
    ?>

    Variable width is a local variable. You can't get its value from outside SP. Either change your procedure to a function returning image width or add a second out parameter:
    CREATE OR REPLACE PROCEDURE get_width (
    img_id IN arm_photos.id%TYPE,width OUT INTEGER
    AS
    image ORDSYS.ORDImage;
    BEGIN
    SELECT p.image INTO image FROM arm_photos p
    WHERE p.id = img_id;
    -- Get the image width:
    width := image.getWidth();
    DBMS_OUTPUT.PUT_LINE('Width is ' || width);
    COMMIT;
    END;SY.

  • Calling function from PHP fails..!

    Hi everybody.
    I'm developing a web application using oracle Portal and have made a 'dynamic' page from the Portal. In this page I have a form which execute a php script.
    In the php script I want to get the logged in userid.
    So I try to execute the following code in my php script:
    $plsql = "begin :userid := portal.wwsto_api_session.load_session('MY_DOMAIIN','SUBDOMAIN').get_attribute_as_varchar2('USERNAME'); end;";
    $stmt = OCIParse($conn,$plsql);
    OCIBindByName($stmt, ":userid", $user);
    OCIExecute($stmt);
    I have already set the session data in the dynamic page and have also tested that the session data is working.
    But, in the php script I get the following error messages:
    Warning: ociexecute(): OCIStmtExecute: ORA-06510.....
    ORA-06512: ved "PORTAL.WWCTX_SSO", line 1744 ORA-06510: PL/SQL: ....
    The error message refer to the OCIExecute(..) statement.
    I'm running PHP version 4.3.9 and Oracle 10g on windows 2003 server.
    Hope you can give me some hints!
    sh75.

    Well, the user is already logged in, and I assume that the session should still be valid even though the user goes to a new URL (within the same domain). Dont you agree?
    Steps in my application is as follows:
    1. Set session data in dynamic page
    2. User press submit bottom which call php-script
    3. php script tries to fetch session data set in (1) and does insert in a table
    4. php script redirect back to dynamic page (same as (1) )
    I thought this was trivial.....
    sh75

  • Calling java host command in trigger/PLSQL

    I created a java call to execute a linux host command that calls a shell script that will echo out a result. It is owned by SYS and has granted execute to SYSTEM. SYSTEM has a table that monitors accesses to the RDBMS. When a user logs on from a remote server vis sqlplus, this LOGON trigger write to the SYSTEM table (successfully). SYSTEM has a trigger that runs a linux command to execute a shell script that pulls the actual IP address from the remote system. I can run this call from a PLSQL block (outside the trigger) and get a response back like "user:101.101.101.111" but when I have the same user log on, the trigger fires - no errors or exceptions yet no rows are returned. Is there some restriction in a trigger versus just a plsql block call? The java code used is what I found on (http://www.oracle-base.com/articles/8i/ ... mPLSQL.php) and it works perfectly OUTSIDE the trigger but nothing is returned in the trigger firing steps. Any idea?
    rdbms: 11.1.0.7, Redhat 4
    I know the code works because I can write the host command output to a file. Later in the trigger I can open the file and can read the data that should have been returned in the java host call.

    FYI - here is the code from your site that I used:
    DROP JAVA SOURCE SYS."Host";
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED SYS."Host" as import java.io.*;
    public class Host {
    public static void executeCommand(String command) {
    try {
    String[] finalCommand;
    if (isWindows()) {
    finalCommand = new String[4];
    // Use the appropriate path for your windows version.
    finalCommand[0] = "C:\\windows\\system32\\cmd.exe"; // Windows XP/2003
    //finalCommand[0] = "C:\\winnt\\system32\\cmd.exe"; // Windows NT/2000
    finalCommand[1] = "/y";
    finalCommand[2] = "/c";
    finalCommand[3] = command;
    else {
    finalCommand = new String[3];
    finalCommand[0] = "/bin/sh";
    finalCommand[1] = "-c";
    finalCommand[2] = command;
    final Process pr = Runtime.getRuntime().exec(finalCommand);
    pr.waitFor();
    new Thread(new Runnable(){
    public void run() {
    BufferedReader br_in = null;
    try {
    br_in = new BufferedReader(new InputStreamReader(pr.getInputStream()));
    String buff = null;
    while ((buff = br_in.readLine()) != null) {
    System.out.println("Cmd results: " + buff);
    try {Thread.sleep(100); } catch(Exception e) {}
    br_in.close();
    catch (IOException ioe) {
    System.out.println("Exception caught printing process output.");
    ioe.printStackTrace();
    finally {
    try {
    br_in.close();
    } catch (Exception ex) {}
    }).start();
    new Thread(new Runnable(){
    public void run() {
    BufferedReader br_err = null;
    try {
    br_err = new BufferedReader(new InputStreamReader(pr.getErrorStream()));
    String buff = null;
    while ((buff = br_err.readLine()) != null) {
    System.out.println("Cmd Error: " + buff);
    try {Thread.sleep(100); } catch(Exception e) {}
    br_err.close();
    catch (IOException ioe) {
    System.out.println("Exception caught printing process error.");
    ioe.printStackTrace();
    finally {
    try {
    br_err.close();
    } catch (Exception ex) {}
    }).start();
    catch (Exception ex) {
    System.out.println(ex.getLocalizedMessage());
    public static boolean isWindows() {
    if (System.getProperty("os.name").toLowerCase().indexOf("windows") != -1)
    return true;
    else
    return false;
    /

  • How to create SSWA plsql function in Oracle Apps of HTML call .html

    Hello Team,
    I am working on Oracle Apps 11i (11.5.10.2)
    I want to know , what is the process to create a , "SSWA plsql function" in Oracle Apps of type "HTML" and html call tab.
    How to create that Function and how to attach the PL/SQL code to these functions.
    How it works.
    Please help me to understand this concept from basics.
    Kind Regards

    Hi;
    Please review:
    how to setup a forms function in R12 to launch an URL?
    http://www.trutek.com/serendipity/index.php?/archives/15-An-Example-of-How-to-Create-Custom-Functions,-Menus,-and-Responsibilities.html
    Regard
    Helios

  • PHP and Oracle DB Job Find

    Hi every ones:
    I'm develop some applications using PHP and Oracle and php give me a lot of advantage. in bouth way of access to a database, OCI and mod plsql.
    How can i say to Oracle THANKS FOR TAKE SERIOUS PHP TECNOLOGY!!!
    I work actually for a company that implement all (Microsoft) and i want find a job with PHP and Oracle programming. Any body have idea that where i need look?

    How can i say to Oracle THANKS FOR TAKE SERIOUS PHP
    TECNOLOGY!!!You just did! Thanks!
    You can help Oracle with scripting languages even more, by completing the questionnaire on scripting langauges at:
    http://www.oracle.com/go/?&Src=1545492&Act=10
    Alison

  • How to trace the flow of plsql procedures/functions in oracle 10g

    Hi All,
    Recently I came to know that there is dbms_hprof PL/SQL built-in package in Oracle 11g which can be used to trace PL/SQL calls in a Hierarchical way. (acts as a PL/SQL Hierarchical Profiler).
    Steps are given in -
    http://www.oracle-base.com/articles/11g/PlsqlHierarchicalProfiler_11gR1.php
    I would like to know whether there is a similar package in Oracle 10g because I want to trace the flow of plsql procedure and function calls in order to generate an output in a hierarchical way (for debug purposes).
    The following example shows the flow of procedure calls when I execute PACKAGE_A.Proceudure_A. I want to generate that kind of an output.
    Ex -
    PACKAGE_A.Proceudure_A
    ----|_PACKAGE_A.Proceudure_B
    ----|------|_PACKAGE_B.Proceudure_C
    ----|_PACKAGE_B.Proceudure_M
    ----|------|_PACKAGE_A.Proceudure_B
    ----|-------------|_PACKAGE_C.Proceudure_C
    ----|_PACKAGE_Z.Proceudure_Z
    If there is no similar package in *10g* I would really appreciate if someone can provide me directions to get the job done using the exsting packages and tables in Oracle 10g. Thanks in advance.
    Edited by: user8326781 on Nov 28, 2008 8:57 PM
    Edited by: user8326781 on Nov 28, 2008 8:58 PM
    Edited by: user8326781 on Nov 29, 2008 12:19 AM

    I am not sure that this would serve the purpose or not but still, I guess its worth to atleast be mentioned,
    http://www.oracle-base.com/articles/9i/DBMS_TRACE.php
    HTH
    Aman....

  • Regarding PLSQL web services

    I'm calling a plsql stored procedure on PHP. The URL looks something like
    http://<servername><port>/pls/<DAD>/packagename.procedurename
    I get HTTP 404 error if the procedure has a PLSQL table type parameter in it.
    Any ideas why it's so? Has the mod_plsql settings got something to do with this, because this behavior is not seen on all environments?
    DB version: 8.1.7.3.0

    Check SICF that the service is activated.
    Go to ST01, start an authorisation trace. Attempt to use the service, then look at the trace to check if it's an auth issue.
    Check SM21 for any indication of an issue at that time.
    The problems I've encountered have been the service not being activated, the role not having the service included with the correct hash entry as in USOBHASH, or other authorisation errors.
    Finally, go to SMICM, and using one of the options there, up the trace level to 3. But if you get to that stage, you're really getting into networking type knowledge.

  • PlSql Package in Jdeveloper

    I want to use Plsql packages for insert/update/delete in Jdeveloper Jsp forms . Can anyone help me regarding this . Thanks in Advance
    Thanks
    N.Nagarajan

    Or you could create an EntityObject based on a view, and have your Pl/SQL package called by "instead of" triggers on this view. This way, you keep a consistent interface between various applications (for instance, a BC4J application and something built with PHP).

  • Calling function from PHP

    How do you call a function plsql from PHP 5.0 and Oracle 10g XE?
    Thank you

    Two tips
    1 Otn.oracle.com has a tutorial section. Tutorials on PHP exist.
    2 This is the SQL forum, the PHP forum is PHP.
    I suggest you either read the tutorial or repost your question in this more appropiate forum.
    Sybrand Bakker
    Senior Oracle DBA

  • Plsql that send an asp page to a determine ip server

    hi, i would like to know how i can send an asp page to a determine ip server, with a plsql procedure.
    My plsql procedure should start, when an e-mail come to my server and read it the plsql procedure should send my asp page.
    thnkz MC

    Hey All,
    I have a bit of an issue the heap memory in the Sun
    JVM with upload applets.
    Please note I'm not a java programmer at all, I know
    some asp, php and JavaScript but that is about it.
    We use an upload applet to get data from our clients
    into our website. Now if the file they are trying to
    upload is over a certain size the upload stalls.
    An "applet" means it is java.
    We have, up till now been instructing users to go
    into the Java program and add the following parameter
    -Xmx256m. The 256 number could change depending the
    size of the file and how much memory the user has.
    Many users find this hard and some have made
    mistakes.
    It would suggest to me that there is a problem with the applet. Although that depends on what you do with the data once you get it.
    Q. Is there a way to send the -Xmx256m parameter to
    the JVM through an asp page?
    Any way? Certainly. You could write an application (like in C++) that the user downloads and it reconfigures their computer to do absolutely anything.
    You might even be able to do that via ASP. Can you impact the environment via ASP? If yes then you can do it.

  • FTP in PLSQL

    Hi All -
    I am developing a small website using APEX 4.2 which has backend database that has 10-12 tables. All these tables have to be populated on daily basis based on public data published on some website.
    The question is, what are the possible ways to ftp these files into my database. I donot have access to the oracle file system to use the UNIX ftp program to copy the files into Oracle directory and then do a PLSQL API which is explained in http://www.oracle-base.com/articles/misc/ftp-from-plsql.php. Please share your thoughts.
    Thanks,
    -Seenu

    If the file is on a web site, you would need to use HTTP to access it. If the file is on a FTP server, you would need to use FTP to access it. When you click the link to download the file, are you sent to an HTTP:// address or a FTP:// URL?
    You may be able to use the UTL_COMPRESS package to unzip the ZIP file once you download it-- see, for example
    http://technology.amis.nl/2010/03/13/utl_compress-gzip-and-zlib/
    Personally, though, I'd find it easier to write a Java stored procedure to do that. There are way more examples and far more complete libraries for working with ZIP files in Java.
    Once you've unzipped the ZIP file and extracted the file, you'll have to write code to parse the file and load the data into your table.
    Of course, all this would be dramatically easier if you had access to the operating system functions on the server. Then you could simply download, unzip, and parse the file as part of an external table definition with a preprocess step doing all the heavy lifting.
    Justin

  • Execetu script file from plsql

    Is possible execute statements saved in file from plsql block?
    I have file c:\xxx.sql and I want execute it from plsql block. c:\xxx.sql contains DDL and DML statements.
    I need something like
    begin
    execute c:\xxx.sql;
    end;
    thank you for help

    Thank you for reply. Maybe you can help with my problem. I have website and data are in server in mysql database, which I can connect only from localhost. I need get data to oracle database resides on my pc.
    I try create this procedure to get data:
    utl_http.request('http://........../make_ddl_and_dml_script_for_oracle.php'); --run script, which create script ora.sql on server for oracle
    utl_http.request_pieces()--"download" file and save it to my pc
    run ora.sql to create or refresh data in my pc
    I know that I can solve it using java, but exist any solution???
    thank you

  • A book for php and oracle

    Hi.I' m working in an application using php for web development and oracle for server database.My question is until now I found many links about this subject also many books about oracle,plsql and many books about php but I can't found a book about php with oracle and plsql.So my question is are there books about php and oracle?
    Thanks in advance thrylos

    I have seen one in my local book shop, not sure about Internet though.

  • Calling Program from Plsql

    Hi all,
    How can i call another program from a plsql code.
    For example opening a notepad in windows from plsql code.
    Please give detailed explanation
    Thanks
    Akshat

    If the purpose is scheduling external programs, the best way would be to use the Oracle Scheduler.
    [url http://docs.oracle.com/cd/E11882_01/server.112/e25494/schedover.htm#i1106753]Chapter 28, [url http://docs.oracle.com/cd/E11882_01/server.112/e25494/scheduse.htm#i1033533]Chapter 29 and [url http://docs.oracle.com/cd/E11882_01/server.112/e25494/schedadmin.htm#i1007589]Chapter 30 in the Administrator's Guide.
    Particularly [url http://docs.oracle.com/cd/E11882_01/server.112/e25494/scheduse002.htm#CIAJCFHE]Techniques for external jobs.
    Scheduler jobs is the best way, because security is built into the system - you can use proper O/S credentials, grant rights, etc.
    Manually calling external jobs from PL/SQL is not as easy. It is possible using for example some Java stored procedure, but it is more difficult to ensure security - it can too easily open up for your database users to execute too many possible O/S commands ;-)
    Edit:
    PS: Tim Hall shows some examples of Scheduler usage [url http://www.oracle-base.com/articles/10g/Scheduler10g.php]here - one of the examples is calling a shell script (unix lingo for batch job ;-) )
    Edited by: Kim Berg Hansen on Nov 30, 2011 12:56 PM

Maybe you are looking for

  • Preview doesn't show up in the capture window

    When trying to capture, the video preview doesn't show up in the capture window, only the color bars. I am able to run my transport with the buttons and the key commands, so I know the Canon ZR500 is really communicating (easy setup: DV-NTSC), via fi

  • Apple Mac Studio Display 23" cinema with plastic surround

    Does anyone have any idea what this monitor might be worth nowadays.

  • API for Updating Attribute in CZ

    Hi All, Could you please suggest me any Standard API to update the Attribute Value in cz_config_ext_attributes. Thank you, Aush

  • How to soften/transform the background edges of a picture

    Working with PS CS 5.5 Background: I have succsssfully used the Transform=>Skew command to 'square' a photo of an art canvas. And have cropped the photo to the edge of the canvas. Question: What are the steps/strategy to selecting the black/dark back

  • Help with the new Bios 1.56 AND RAM Q

    can high voltage for Ram, A-DATA 2X512 DDR500   2.85 for this case, can cause instablity, how do i know when to raise it, because it look like running fine with 2.70, and i oced it to 270mhz , 4000 in sandra.   so what should the voltage be? and what