OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
php-general Digest 13 Apr 2008 17:08:08 -0000 Issue 5402

php-general-digest-helplists.php.net
Date: Sun Apr 13 2008 - 12:08:08 CDT


php-general Digest 13 Apr 2008 17:08:08 -0000 Issue 5402

Topics (messages 272950 through 272955):

Re: Include problems
        272950 by: Bojan Tesanovic

Re: Return an Array and immediately reference an index
        272951 by: Bojan Tesanovic

Re: standard format for Web portal administration side
        272952 by: Bojan Tesanovic

Re: Send XML file with curl functions
        272953 by: Bojan Tesanovic
        272955 by: Aaron Axelsen

Re: Common PHP functions benchmarks
        272954 by: Nathan Nobbe

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


On Apr 12, 2008, at 8:28 AM, GoWtHaM NaRiSiPaLli wrote:

> if(file_exists("../common/config.ini")) {
> $configData = parse_ini_file("../common/config.ini");
> } else {

Try changing above code so it reads

if(file_exists("common/config.ini")) {
   $configData = parse_ini_file("common/config.ini");
} else {

As the xyz.php is in

/var/www/sites/project/ folder , and that is the starting path of
the script

so any script that needs to include
/var/www/sites/project/common/someFile.php
you need to specify relative path to '/var/www/sites/project/' which
is 'common/someFile.php'

this should work unless some of included files uses 'chdir' function
that changes current directory

Igor Jocic
http://www.carster.us/ Used Car Classifieds

attached mail follows:


On Apr 12, 2008, at 6:18 PM, Casey wrote:

> On Sat, Apr 12, 2008 at 9:12 AM, Nathan Nobbe
> <quickshiftingmail.com> wrote:
>> On Fri, Apr 11, 2008 at 6:33 PM, Daniel Kolbo <kolb0057umn.edu>
>> wrote:
>>
>> search the archives ;)
>>
>> http://www.mail-archive.com/php-generallists.php.net/msg224626.html
>>
>> -nathan
> <?php
> function ReturnArray() {
> return array('a' => 'f', 'b' => 'g', 'c' => 'h', 'd' => 'i',
> 'e' => 'j');
> }
>
> echo ${!${!1}=ReturnArray()}['a']; // 'f'
> ?>
>
> :)
> --
> -Casey
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

WOW!! PHP always surprises me, this is the pros of PHP not being
strict type language.

Igor Jocic
http://www.carster.us/

attached mail follows:


On Apr 12, 2008, at 7:19 PM, Alain Roger wrote:

> Hi,
>
> I've seen several web portal and their dedicated administration side.
> some of those administration (portal) are according to w3c standard
> (1024 px
> large), but most of them use the full screen width.
>
> therefore i would like to know if there is a standard size (width /
> height)
> for web portal administration side ?
> what do you do usually ?
>
> thx.
>
> --
> Alain
> ------------------------------------
> Windows XP SP2
> PostgreSQL 8.2.4 / MS SQL server 2005
> Apache 2.2.4
> PHP 5.2.4
> C# 2005-2008

Completely depends on application design.
My favor last few months is to use some standard width as now we will
se more and more >1024 px user screen resolutions,
and making site full width will make users with higher resolutions to
tilt head left-right like watching tennis :D
Its more user friendly to have user focus on center of screen and
fixed width eg 980px , and with use of Ajax/DHTML, application
doesn't need to use all space available as you can easily pop up less
commonly used features let the user hide what he doesn't need
rearrange elements etc etc

Igor Jocic
http://www.carster.us/

attached mail follows:


On Apr 12, 2008, at 11:37 PM, Aaron Axelsen wrote:

> I am trying to create the following command with the php curl
> functions:
>
> curl -F "data=domain.xml" "http://path/to/api"
>
> The problem i'm having is that i'm creating the xml file with php -
> so the contents are stored in a variable. How can I send the
> contents of that variable via curl? I thought just assigning the
> xml variable to data would work - but it hasn't.
>
> Any suggestions?
>
> --
> Aaron Axelsen
> listsfrozenpc.net
>
> Great hosting, low prices. Modevia Web Services LLC -- http://
> www.modevia.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

What I can suggest
1. save the XML to file eg xmldata.xml and use
system('curl -F "data=xmldata.xml" "http://path/to/api" ');

2. or Use PHP CURL functions

fufunction postData($postFileds,$url){
                $ch = curl_init();
                curl_setopt($ch, CURLOPT_URL, $url);
                curl_setopt($ch, CURLOPT_POST ,1);
                curl_setopt($ch, CURLOPT_POSTFIELDS ,$postFileds);
                curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1);
                curl_setopt($ch, CURLOPT_HEADER ,0); // DO NOT RETURN HTTP
HEADERS
                curl_setopt($ch, CURLOPT_RETURNTRANSFER ,1); // RETURN THE
CONTENTS OF THE CALL
                $data = curl_exec($ch);
                curl_close($ch);
                return $data;
        }

$xmlData = 'some xml data';
$postFileds = 'data='. urlencode($xmlData);

//call function
postData($postFileds,"http://path/to/api");

-------
Bojan
http://www.carster.us/

attached mail follows:


Option 2 is what I'm trying to do, but the problem is that when curl
sends the file over the command line, when it's processes via PHP the
attached file comes over $_FILES.

But, added the postdata obviously doesn't allow it to come over that
way. Is there any way to use option 2 and transmit the file so it will
come over under $_FILES?

-- Aaron

Bojan Tesanovic wrote:
>
> On Apr 12, 2008, at 11:37 PM, Aaron Axelsen wrote:
>
>> I am trying to create the following command with the php curl functions:
>>
>> curl -F "data=domain.xml" "http://path/to/api"
>>
>> The problem i'm having is that i'm creating the xml file with php -
>> so the contents are stored in a variable. How can I send the
>> contents of that variable via curl? I thought just assigning the xml
>> variable to data would work - but it hasn't.
>>
>> Any suggestions?
>>
>> --
>> Aaron Axelsen
>> listsfrozenpc.net
>>
>> Great hosting, low prices. Modevia Web Services LLC --
>> http://www.modevia.com
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
>
>
> What I can suggest
> 1. save the XML to file eg xmldata.xml and use
> system('curl -F "data=xmldata.xml" "http://path/to/api" ');
>
> 2. or Use PHP CURL functions
>
> fufunction postData($postFileds,$url){
> $ch = curl_init();
> curl_setopt($ch, CURLOPT_URL, $url);
> curl_setopt($ch, CURLOPT_POST ,1);
> curl_setopt($ch, CURLOPT_POSTFIELDS ,$postFileds);
> curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1);
> curl_setopt($ch, CURLOPT_HEADER ,0); // DO NOT RETURN
> HTTP HEADERS
> curl_setopt($ch, CURLOPT_RETURNTRANSFER ,1); // RETURN THE
> CONTENTS OF THE CALL
> $data = curl_exec($ch);
> curl_close($ch);
> return $data;
> }
>
> $xmlData = 'some xml data';
> $postFileds = 'data='. urlencode($xmlData);
>
> //call function
> postData($postFileds,"http://path/to/api");
>
>
>
> -------
> Bojan
> http://www.carster.us/
>
>
>
>
>

--
Aaron Axelsen
listsfrozenpc.net

Great hosting, low prices. Modevia Web Services LLC --
http://www.modevia.com

attached mail follows:


On Tue, Apr 8, 2008 at 4:00 PM, Nathan Nobbe <quickshiftingmail.com> wrote:

> i did some tests a couple of months ago; pitting array iteration vs.
> iteration w/ spl iterators. link is down atm; but will be back soon and ill
> post again so you have something similar to look at. a quick glance shows
> you have some thorough tests; but for the results some graphs would be nice
> :) kinda hard to see 'the big picture' w/o them.
>

got the dev site back up. heres the tests; let me know if they dont
resolve.

http://nathan.moxune.com/arrayVsArrayIteratorReport.php

-nathan