Don’t ask me why I had to do this, but at work today, I had the need to post files up to a remote server while running the php script behind our firewall. Basically, we needed to make files inside our firewall available on the internet. I found out that the native fopen command cannot easily be configured to post via a proxy server so I had to implement the curl solution with the help of a work mate (Thanks Dean!).
I’ve attached the code below for those who has the need to do the same thing as I. When looking at the code, take note of line 2. Most work accounts belong to a domain, but some don’t so for those not on a domain, make sure you remove DOMAIN\\. For those on a domain take note of the double slash \\ (single slash won’t work).
Happy coding!
<?php
define("C_PROXY_SERVER_URL","proxy.server.com:8080");
define("C_PROXY_PASS","DOMAIN\\username:password");
$upload_url = "http://someremotesite.com/uploader.php";
$sample_file = "c:/Program Files/Apache Software Foundation/Apache2.2/htdocs/phpfileuploader/localuploads/FileZilla.zip";To display all environment variable values for a given oracle session, run the following code:
begin
FOR i IN 1..owa.num_cgi_vars LOOP
htp.p(owa.cgi_var_name(i)||' : '||owa.cgi_var_val(i));
END LOOP;
end;
The name of the environment variable and value will be displayed. To reference each variable individually use the following syntax:
OWA_UTIL.get_cgi_env(VARIABLE_NAME)
eg. OWA_UTIL.get_cgi_env('REQUEST_PROTOCOL')
Here’s the list of all available variables:
PLSQL_GATEWAY
GATEWAY_IVERSION
SERVER_SOFTWARE
GATEWAY_INTERFACE
SERVER_PORT
SERVER_NAME
REQUEST_METHOD
PATH_INFO
SCRIPT_NAME
REMOTE_ADDR
SERVER_PROTOCOL
REQUEST_PROTOCOL
REMOTE_USER
HTTP_CONTENT_LENGTH
HTTP_CONTENT_TYPE
HTTP_USER_AGENT
HTTP_HOST
HTTP_ACCEPT
HTTP_ACCEPT_ENCODING
HTTP_ACCEPT_LANGUAGE
HTTP_REFERER
HTTP_ORACLE_ECID
WEB_AUTHENT_PREFIX
DAD_NAME
DOC_ACCESS_PATH
DOCUMENT_TABLE
PATH_ALIAS
REQUEST_CHARSET
REQUEST_IANA_CHARSET
SCRIPT_PREFIX
HTTP_COOKIE
Sample Output:
PLSQL_GATEWAY : WebDb
GATEWAY_IVERSION : 3
SERVER_SOFTWARE : Oracle-Application-Server-10g/10.1.2.0.0 Oracle-HTTP-Server
GATEWAY_INTERFACE : CGI/1.1
SERVER_PORT : 7780
SERVER_NAME : lxapp0533v
REQUEST_METHOD : POST
PATH_INFO : /wwv_flow.show
SCRIPT_NAME : /pls/dmt
REMOTE_ADDR : 148.132.152.59
SERVER_PROTOCOL : HTTP/1.1
REQUEST_PROTOCOL : HTTP
REMOTE_USER : APEX_PUBLIC_USER
HTTP_CONTENT_LENGTH : 416
HTTP_CONTENT_TYPE : application/x-www-form-urlencoded
HTTP_USER_AGENT : Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
HTTP_HOST : lxapp0533v.in.telstra.com.au:7780
HTTP_ACCEPT : */*
HTTP_ACCEPT_ENCODING : gzip, deflate
HTTP_ACCEPT_LANGUAGE : en-au
HTTP_REFERER : http://lxapp0533v.in.telstra.com.au:7780/pls/dmt/f?p=4500:1003:4479870342920497::NO:::
HTTP_ORACLE_ECID : 1297402712:144.135.172.44:22243:0:21186,0
WEB_AUTHENT_PREFIX :
DAD_NAME : dmt
DOC_ACCESS_PATH : docs
DOCUMENT_TABLE : wwv_flow_file_objects$
PATH_ALIAS :
REQUEST_CHARSET : UTF8
REQUEST_IANA_CHARSET : UTF-8
SCRIPT_PREFIX : /pls
HTTP_COOKIE : ISCOOKIE=true; LOGIN_USERNAME_COOKIE=d205414; LOGIN_PASSWORD_COOKIE=; LOGIN_REMEMBER_ME_COOKIE=; r1=%23ALL; r2=%23ALL; r3=%23ALL; propHide=4301%2C%23ALL; WWV_FLOW_USER2=47770A7FD83D3E0A; ORACLE_PLATFORM_REMEMBER_UN=D205414:dmt; __ppFullPath=di-di; s_nr=1296902947468; s_evar18=%5B%5B%27referral%27%2C%271296902515781%27%5D%5D; SearchSettings=50,0,0,1,1,1,1,1; HTMLDB_IDLE_SESSION=11-FEB-2011 10:22:00; WWV_CUSTOM-F_955908081711180_100=739B959ED77BAFE2
There is a very useful Oracle ApEx REQUEST constant called BRANCH_TO_PAGE_ACCEPT. If included in a URL, the request will process the page as if it was submitted. Now think about this for a minute because this is a useful tool that can enhance your application dramatically. I will provide an example to make my point. Traditionally clicking on a URL in ApEx will simply load the page requested. Loading a page means that the “After Submit Processes” region in ApEx will never be triggered. As a consequence most programmers will plug their process in in “Before Header” or “After Header” point in their page process restricted via some execution condition. This is highly inefficient because it means that the process will be evaluated every time the page is accessed.
To improve this process, add a BRANCH_TO_PAGE_ACCEPT Request in your Column Link. This modification will submit the page requested which will then allow you to place the process in the “After Submit” region. Execution of the block will be more targetted making you application more efficient.

The request looks something like this:
f?p=&APP_ID.:23:&SESSION.:BRANCH_TO_PAGE_ACCEPT:&DEBUG.::P0_REQ_ID:#ID#
Happy Coding!
We don’t all possess superpowers. In fact, like me, a lot of us cannot read minds. There’s this great gadget invented which is installed on all vehicles called the signal light. The idea is if you intend to make a left or right turn, you flick this little lever near your steering wheel to the direction where you expect to turn into. This action will activate the signal light on the outside of your vehicle, on the left or right side, depending on which direction you flicked the lever. These set of actions effectively communicates where the driver intends to go, well before he/she gets there. This is necessary so that everyone else around him/her can negotiate their manoeuvres effectively, all in the effort of preventing an accident.
I want to focus the attention to a specific scenario – The dreaded roundabout. I don’t know about you but I think that there’s an unwritten rule that you have to go through a roundabout as fast as possible and signalling is optional. Throw in pedestrians and bicycle riders in the mix and the result could be catastrophic.
Every driver on the road has a responsibility. A responsibility to be up to date with their knowledge of the road rules, to obey these rules, be considerate when driving and to drive safely at all times. I think a lot of us forget how dangerous it is to be on or near the roads.
Please always remember.
I’ve written a file archiving process in ASP that auto creates the directory structure on the main archive folder. The process uses the first four characters of the file to create the directory. It then proceeds to place the file in that directory. As a result all files with common first four characters are placed in a single directory.
Anyway, one of the files archived had the name LPT199999.csv. The ASP process created the archive directory with the name LPT1 and placed the file in it with no issues at all. The only problem is LPT1 is a reserve-word, and when you try to copy this directory to another, it fails with the following error:

When you try to delete the folder named LPT1, you get the following error:

Fortunately, there is a way to delete the directory and prevent further problems. You need to use a syntax that bypasses the typical reserve-word checks completely. For example, you can possibly remove any directory with a command such as:
RMDIR \\.\driveletter:\path\filename
eg. In my case, I deleted all files in the LPT1 directory and ran the following command to remove the directory:
RMDIR \\.\C:\backupdir\LPT1
That’s it… Too easy!

Recent Comments