php-general Digest 13 Apr 2008 00:36:36 -0000 Issue 5401

Topics (messages 272927 through 272949):

Re: newsletter administration
        272927 by: Bill

Re: Evaluating math without eval()
        272928 by: Ray Hauge

Re: Return an Array and immediately reference an index
        272929 by: Daniel Kolbo
        272930 by: Daniel Kolbo
        272933 by: Stut
        272935 by: Nathan Nobbe
        272936 by: Casey
        272937 by: Nathan Nobbe
        272938 by: Casey
        272939 by: Daniel Kolbo

Re: php local application send mouse click
        272931 by: Daniel Kolbo
        272934 by: Stut

Re: File Upload Security
        272932 by: Al

standard format for Web portal administration side
        272940 by: Alain Roger

Quarters [SOLVED]
        272941 by: tedd

Importing / Adding Fields Into MySql From A List
        272942 by: revDAVE

Need a simple one time search utility
        272943 by: Al
        272944 by: Casey
        272945 by: Al
        272946 by: Nathan Nobbe
        272947 by: Al

Send XML file with curl functions
        272948 by: Aaron Axelsen

Re: install pecl in debian
        272949 by: hce

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
Hi Alain

I would use RSS.
My friend Google gave me that link to try
http://www.feedforall.com/free-php-script.htm

> this newsletter should be in HTML format and send 1 by 1 to each customer.



--- End Message ---
--- Begin Message ---
Jason Norwood-Young wrote:
On Thu, 2008-04-10 at 13:15 +0100, Richard Heyes wrote:
First post to this list! I'm trying to figure out how to evaluate a
string with a mathematical expression and get a result, but without
using eval() as I'm accepting user input into the string. I don't just
want addition, subtraction, multiplication and division - I'd like to
take advantage of other functions like ceil, floor etc.
So the string "18-10" should give me 8, "ceil(1/2)*10" should be 10 (if
my maths is correct) and the string "18-10;\r\nunlink('/var/www/*');"
should not execute.
If you can provide your users with distinct inputs (if it's a form) go that route.

Thanks Richard

Unfortunately it's not that simple. The equation sits in a DB and can be
anything - eg. ((([valuation]/[purchaseprice])/100)*100)/[numyears]
would be a typical field. [valuation], [purchaseprice] and [numyears]
gets replaced by relevant fields from user-entered data. But the system
is expandable which means I don't know what the equations, data or
fields are going to be beforehand.
I'm working on some kinda preg_replace function to sanitize the data at
the moment and then run an eval - arg I hate regexp! Ideally eval would
have some kind of sandboxing option, or you could limit the functions
available in an eval.

J



you might be able to leverage a call to expr on a bash sell. Just replace the variables you're expecting with preg_replace or some similar function.

http://hacktux.com/bashmath
http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/

I'm not sure if that's any more secure than eval though.

--
Ray Hauge
www.primateapplications.com

--- End Message ---
--- Begin Message ---


Jim Lucas wrote:
Bojan Tesanovic wrote:

On Apr 12, 2008, at 12:33 AM, Daniel Kolbo wrote:

Hello,

I want to return an array from function and reference an index all in one line. Is this possible?

In the code below I want I want $yo to be the array(5,6).

Here is what I've tried,

function returnarray() {
    return array('lose' => array(5,6), 'win' => array(9,8));
}

$yo = returnarray()['lose'];
var_dump($yo);

This yields a parse error.
function returnarray() {
    return array('lose' => array(5,6), 'win' => array(9,8));
}

$yo = {returnarray()}['lose'];
var_dump($yo);

This yields a parse error.

function returnarray() {
    return array('lose' => array(5,6), 'win' => array(9,8));
}

$yo = ${returnarray()}['lose'];
var_dump($yo);

This gives notices as the result of returnarray() is being converted to a string. $yo === NULL...not what i want.

function returnarray() {
    return array('lose' => array(5,6), 'win' => array(9,8));
}

$yo = returnarray()->['lose'];
var_dump($yo);

This yields a parse error.

function returnarray() {
    return array('lose' => array(5,6), 'win' => array(9,8));
}

$yo = ${returnarray()}->['lose'];
var_dump($yo);

This yields a parse error.

Thanks for your help in advance.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




This is not possible in PHP, though you can have a Array wrapper class

function returnarray() {
return new ArrayObject( array('lose' => array(5,6), 'win' => array(9,8)) );
}
var_dump (returnarray()->offsetGet('lose'));


or even better make you own wrapper class with __set() and __get() methods so you can have

var_dump (returnarray()->lose);

of course only in PHP5

Well, not quite so fast saying this is only possible in PHP5

You could do something like this.

<?php

function returnHash() {
  return (object) array('lose' => array(5,6), 'win' => array(9,8));
}

print_r(returnHash()->lose);

?>

Basically, this converts your newly built array into an object, using the stdClass object.

Then reference the index via an object variable name instead of an array style access method.





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









Thanks, I appreciate your comment Bojan
DanK

--- End Message ---
--- Begin Message ---


Stut wrote:
On 12 Apr 2008, at 00:31, Daniel Kolbo wrote:
Philip Thompson wrote:
On Apr 11, 2008, at 5:33 PM, Daniel Kolbo wrote:
I want to return an array from function and reference an index all in one line. Is this possible?

In the code below I want I want $yo to be the array(5,6).

Here is what I've tried,

function returnarray() {
   return array('lose' => array(5,6), 'win' => array(9,8));
}

$yo = returnarray()['lose'];
var_dump($yo);

This yields a parse error.

function returnarray() {
   return array('lose' => array(5,6), 'win' => array(9,8));
}

$yo = {returnarray()}['lose'];
var_dump($yo);

This yields a parse error.

function returnarray() {
   return array('lose' => array(5,6), 'win' => array(9,8));
}

$yo = ${returnarray()}['lose'];
var_dump($yo);

This gives notices as the result of returnarray() is being converted to a string. $yo === NULL...not what i want.

function returnarray() {
   return array('lose' => array(5,6), 'win' => array(9,8));
}

$yo = returnarray()->['lose'];
var_dump($yo);

This yields a parse error.

function returnarray() {
   return array('lose' => array(5,6), 'win' => array(9,8));
}

$yo = ${returnarray()}->['lose'];
var_dump($yo);

This yields a parse error.

The PHP parser does not support this, but you may see it in a future version - it's a commonly requested feature.

There are various ways to code around this limitation as other posters have stated but to me they all add far too much processing to make it worth saving a line of code and a temporary variable.

-Stut


Thanks Stut. By chance do you know of any proposed syntax for this feature? Or, what syntax would seem logical to you?

DanK

--- End Message ---
--- Begin Message ---
On 12 Apr 2008, at 15:18, Daniel Kolbo wrote:
Stut wrote:
On 12 Apr 2008, at 00:31, Daniel Kolbo wrote:
Philip Thompson wrote:
On Apr 11, 2008, at 5:33 PM, Daniel Kolbo wrote:
I want to return an array from function and reference an index all in one line. Is this possible?

In the code below I want I want $yo to be the array(5,6).

Here is what I've tried,

function returnarray() {
  return array('lose' => array(5,6), 'win' => array(9,8));
}

$yo = returnarray()['lose'];
var_dump($yo);

This yields a parse error.

function returnarray() {
  return array('lose' => array(5,6), 'win' => array(9,8));
}

$yo = {returnarray()}['lose'];
var_dump($yo);

This yields a parse error.

function returnarray() {
  return array('lose' => array(5,6), 'win' => array(9,8));
}

$yo = ${returnarray()}['lose'];
var_dump($yo);

This gives notices as the result of returnarray() is being converted to a string. $yo === NULL...not what i want.

function returnarray() {
  return array('lose' => array(5,6), 'win' => array(9,8));
}

$yo = returnarray()->['lose'];
var_dump($yo);

This yields a parse error.

function returnarray() {
  return array('lose' => array(5,6), 'win' => array(9,8));
}

$yo = ${returnarray()}->['lose'];
var_dump($yo);

This yields a parse error.
The PHP parser does not support this, but you may see it in a future version - it's a commonly requested feature. There are various ways to code around this limitation as other posters have stated but to me they all add far too much processing to make it worth saving a line of code and a temporary variable.
-Stut

Thanks Stut. By chance do you know of any proposed syntax for this feature? Or, what syntax would seem logical to you?

I'm sure I've seen it discussed on the internals list but I don't know if anything has been agreed. Your best bet is to search the archives for the internals list.

-Stut

--
http://stut.net/

--- End Message ---
--- Begin Message ---
On Fri, Apr 11, 2008 at 6:33 PM, Daniel Kolbo <[EMAIL PROTECTED]> wrote:

search the archives ;)

http://www.mail-archive.com/[EMAIL PROTECTED]/msg224626.html

-nathan

--- End Message ---
--- Begin Message ---
On Sat, Apr 12, 2008 at 9:12 AM, Nathan Nobbe <[EMAIL PROTECTED]> wrote:
> On Fri, Apr 11, 2008 at 6:33 PM, Daniel Kolbo <[EMAIL PROTECTED]> wrote:
>
>  search the archives ;)
>
>  http://www.mail-archive.com/[EMAIL PROTECTED]/msg224626.html
>
>  -nathan
<?php
function ReturnArray() {
    return array('a' => 'f', 'b' => 'g', 'c' => 'h', 'd' => 'i', 'e' => 'j');
}

echo ${!${!1}=ReturnArray()}['a']; // 'f'
?>

:)
-- 
-Casey

--- End Message ---
--- Begin Message ---
On Sat, Apr 12, 2008 at 12:18 PM, Casey <[EMAIL PROTECTED]> wrote:

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


ya; i never did sit down and try to figure out how that works; care to
explain ?

-nathan

--- End Message ---
--- Begin Message ---
On Sat, Apr 12, 2008 at 9:35 AM, Nathan Nobbe <[EMAIL PROTECTED]> wrote:
>
> On Sat, Apr 12, 2008 at 12:18 PM, Casey <[EMAIL PROTECTED]> wrote:
>
>
> >
> >
> >
> > On Sat, Apr 12, 2008 at 9:12 AM, Nathan Nobbe <[EMAIL PROTECTED]>
> wrote:
> > > On Fri, Apr 11, 2008 at 6:33 PM, Daniel Kolbo <[EMAIL PROTECTED]> wrote:
> > >
> > >  search the archives ;)
> > >
> > >  http://www.mail-archive.com/[EMAIL PROTECTED]/msg224626.html
> > >
> > >  -nathan
> > <?php
> > function ReturnArray() {
> >    return array('a' => 'f', 'b' => 'g', 'c' => 'h', 'd' => 'i', 'e' =>
> 'j');
> > }
> >
> > echo ${!${!1}=ReturnArray()}['a']; // 'f'
> > ?>
>
> ya; i never did sit down and try to figure out how that works; care to
> explain ?
>
> -nathan
>

<?php
echo ${!${!1}=ReturnArray()}['a'];

${!${!1}=ReturnArray()}['a']
 !1 resolves to false.
${!${false}=ReturnArray()}['a']
 false resolves to... I don't know. Let's just say false resolves to "a".
${!$a=ReturnArray()}['a']
 $a is now the array. The ! changes the returned array into the
boolean false (like: if (!$handle = fopen('x', 'r')) { echo
'connection failed' }.
${false}['a']
 I don't know what false resolves to, but we're using "a".
$a['a']
?>
-- 
-Casey

--- End Message ---
--- Begin Message ---


Casey wrote:
On Sat, Apr 12, 2008 at 9:35 AM, Nathan Nobbe <[EMAIL PROTECTED]> wrote:
On Sat, Apr 12, 2008 at 12:18 PM, Casey <[EMAIL PROTECTED]> wrote:




On Sat, Apr 12, 2008 at 9:12 AM, Nathan Nobbe <[EMAIL PROTECTED]>
wrote:
On Fri, Apr 11, 2008 at 6:33 PM, Daniel Kolbo <[EMAIL PROTECTED]> wrote:

 search the archives ;)

 http://www.mail-archive.com/[EMAIL PROTECTED]/msg224626.html

 -nathan
<?php
function ReturnArray() {
   return array('a' => 'f', 'b' => 'g', 'c' => 'h', 'd' => 'i', 'e' =>
'j');
}

echo ${!${!1}=ReturnArray()}['a']; // 'f'
?>
ya; i never did sit down and try to figure out how that works; care to
explain ?

-nathan


<?php
echo ${!${!1}=ReturnArray()}['a'];

${!${!1}=ReturnArray()}['a']
 !1 resolves to false.
${!${false}=ReturnArray()}['a']
 false resolves to... I don't know. Let's just say false resolves to "a".
${!$a=ReturnArray()}['a']
 $a is now the array. The ! changes the returned array into the
boolean false (like: if (!$handle = fopen('x', 'r')) { echo
'connection failed' }.
${false}['a']
 I don't know what false resolves to, but we're using "a".
$a['a']
?>

Just awesome! Thanks for the explanation Casey, and thanks for the archived link Nathan. I knew I'd learn something by asking.
--- End Message ---
--- Begin Message ---


Stut wrote:
On 12 Apr 2008, at 00:13, Daniel Kolbo wrote:
In addition to the function i mentioned from winbinder wb_send_message() I have tried:

I tried loading in the user32.dll extension from within the php.ini, this failed.
I tried loading in the user32.dll from within the script, this failed.

dl("user32.dll")

The dl function is for loading PHP extensions, not any old DLL. The same goes for the extensions section of php.ini.

I tried loading in the php_w32api.dll from within the script (i copied the php_w32api.dll from php4 into my ext/ folder in php5.

dl("php_w32api.dll");

this worked; however, when I tried registering the functions from within the script it failed on me.

w32api_register_function("User32.dll",
                        "mouse_event",
                        "void");

I really am at a lose of how to even begin. How would I execute a mouse click from a php script on a console application?

1) You should be using SendInput not mouse_event unless you're on Windows 9x.

2) Why are you trying to do this in PHP? It would be much easier to develop and test in C# or VB or even C++. At the very least I'd recommend doing that to get the sequence of API calls worked out and then port it over to PHP.

-Stut


RE: 1) I agree. I read a lot of people were having problems with SendInput, so I just tried it with mouse_event.

RE: 2) I am choosing PHP b/c i am better skilled in PHP. Alas, I have pretty much resigned to having to develop this in C# of VB. I am reading the zend page on developing php extensions. I figure I will develop the php extension in C# or VB, then load it in php. Is this what you mean by "port" to PHP?

Thanks for your help,
DanK

--- End Message ---
--- Begin Message ---
On 12 Apr 2008, at 15:25, Daniel Kolbo wrote:
Stut wrote:
On 12 Apr 2008, at 00:13, Daniel Kolbo wrote:
In addition to the function i mentioned from winbinder wb_send_message() I have tried:

I tried loading in the user32.dll extension from within the php.ini, this failed. I tried loading in the user32.dll from within the script, this failed.

dl("user32.dll")
The dl function is for loading PHP extensions, not any old DLL. The same goes for the extensions section of php.ini.
I tried loading in the php_w32api.dll from within the script (i copied the php_w32api.dll from php4 into my ext/ folder in php5.

dl("php_w32api.dll");

this worked; however, when I tried registering the functions from within the script it failed on me.

w32api_register_function("User32.dll",
                       "mouse_event",
                       "void");

I really am at a lose of how to even begin. How would I execute a mouse click from a php script on a console application?
1) You should be using SendInput not mouse_event unless you're on Windows 9x. 2) Why are you trying to do this in PHP? It would be much easier to develop and test in C# or VB or even C++. At the very least I'd recommend doing that to get the sequence of API calls worked out and then port it over to PHP.
-Stut

RE: 1) I agree. I read a lot of people were having problems with SendInput, so I just tried it with mouse_event.

RE: 2) I am choosing PHP b/c i am better skilled in PHP. Alas, I have pretty much resigned to having to develop this in C# of VB. I am reading the zend page on developing php extensions. I figure I will develop the php extension in C# or VB, then load it in php. Is this what you mean by "port" to PHP?

Get it working in another language so you know which API calls you need, then work on getting access to those calls to work from PHP.

If your only reason for doing it in PHP is your experience I'd suggest just doing it in C# and don't bother porting it. By porting it I mean converting it from C# to PHP.

One other thing worth asking yourself... is there an easier way to achieve what you want than simulating a mouse click? You might have better luck telling the screen control you need to click on that it's been clicked rather than actually programmatically clicking the mouse button. But that's going way beyond the scope of this list. I suggest you ask in one of the MS support forums.

-Stut

--
http://stut.net/

--- End Message ---
--- Begin Message ---
Thanks guys.

I had written a newer version restricted to images which checks MIME and image 
width and height.

I have one application which needs a text file. I think I'll have my users hide a password in it and scan the whole file for <? an <?php and other signs of scripts, etc.

Al wrote:
One of my sites has been hacked and I'm trying to find the hole. The hack code creates dirs with "nobody" ownership, so it's obvious stuff is not via ftp [ownership would be foo]

Site is virtual host, Linux/Apache

I'm concerned about a file uploader my users use to upload photos.

Can anyone see a hole in this scrip? Can my code upload an executable masquerading as an image file?

$filetype = array("gif", "jpg", "jpeg", "png", "txt", css")

function csvt_file_upload($filetype, $max_size)
{
$prohibits = array("exe", "php", "inc", "php3", "pl", "bat", "cgi"); //common executables.
    $absolute_max_size = 2000000;

    end($_FILES); //get the "name" used by the html <input.....
$name = key($_FILES); //could use the register variables, but this is safer.
    if(isset($_FILES[$name]['name'])) $input_name = $_FILES[$name]['name'];

    $error = "no"; //reset for error checks

    if (!isset($filetype)) {
echo "<p style=\"color:red\"> File type assignment missing </p> ";
            $error = "yes";
    };

    if (!isset($max_size)) {
echo "<p style=\"color:red\"> Max file size assignment missing.</p>";
            $error = "yes";
    };

    $filename = $_FILES[$name]['name'];
    $tmp_name = $_FILES[$name]['tmp_name'];
    $size = $_FILES[$name]['size'];

    $absolute_path_file = getcwd(). DATA_DIR . $filename;


    if (($size >= $max_size) OR ($size > $absolute_max_size)) {
        echo "<p style=\"color:red\"> File size is too large.</p> ";
        $error = "yes";
    }

$ext = substr(strrchr($filename, "."), 1); //get the extension, remove the "."
    if (in_array($ext, $prohibits)) {
echo "<p style=\"color:red\">Illegal file type, executable.</p>\r\n";
        $error = "yes";
    }
    if (is_executable($filename)) {
echo "<p style=\"color:red\">Illegal file type, executable file.</p>\r\n";
        $error = "yes";
    } //This is a double check in case $prohibits is incomplete.
    if (is_array($filetype) AND !in_array($ext, $filetype)) {
        echo "<p style=\"color:red\">Illegal file type.</p>\r\n";
        $error = "yes";
    }
    if(!is_array($filetype) AND ($filetype != $ext)){
        echo "<p style=\"color:red\">Illegal file type.</p>\r\n";
        $error = "yes";
    }
    if ($error == "yes") {
echo "<p style=\"color:red\">There was an error(s) with your file selection \"$input_name\" as the note(s) indicates. Please reselect, or remove your file selection and email for help. </p>\r\n";
    }
    else {
        if(!move_uploaded_file($tmp_name, $absolute_path_file))
die("<p style=\"color:red\">There was an error saving your file. Check permissions of " . DATA_DIR . " Must be 777 </p>\r\n"); chmod($absolute_path_file, 0644);
    }

    return;
}

--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
Hi gang:

The error was simply one of variable type in javascript.

In the statement:

document.getElementById(id2).checked = true;

I used id2 = 'c' + id[2] + id[3] and by doing so unknowingly made the result an array instead of a string. In some other languages it would have worked -- and did work for some browsers -- but failed in IE.

However, once that was fixed, the critter works for most current browsers (IE6+, Safari , FF, Opera).

For those interested, here's the finished version:

http://webbytedd.com/quarters/

Thanks for all the help.

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
Newbie question!

I have a list of field names from another database (not mysql) - like:

name
phone1
phone2
street
city
state
zip
info
etc.... (a bunch more fields)

Q: Is there a way I can add these to an existing empty/blank table?

I have phpMyAdmin and If there's a way add tables w / php - maybe that would
work also....

If I can just get all the field names in the table as text fields - that
would be ok for now - then I can individually change the field type by hand
w phpMyAdmin...

BTW: What is the best field type for 'average' text (not large 'BLOBS')
like:

1 - Street address - maybe less than 255 characters
2 - Info field - maybe more than 255 characters

- (let's assume that user might want to search on the fields):

-text?
-char?
-TINYTEXT?
-mediumtext?
-varchar?
-longtext?

Q: Is there a url to read about the types?

I'm looking at these now but not quite sure ...

http://dev.mysql.com/doc/refman/5.1/en/char.html
http://dev.mysql.com/doc/refman/5.1/en/blob.html


--
Thanks - RevDave
Cool @ hosting4days . com
[db-lists]




--- End Message ---
--- Begin Message ---
I need a simple utility that simulates GREP to find a certain string in any php 
files on my website.

Site is on a shared host w/o shell access so I can't run GREP.

I can write a PHP scrip to do it; but, this is a one time thing and I was hoping to find something to save me the effort.

Thanks....

--- End Message ---
--- Begin Message ---
On Apr 12, 2008, at 12:13 PM, Al <[EMAIL PROTECTED]> wrote:

I need a simple utility that simulates GREP to find a certain string in any php files on my website.

Site is on a shared host w/o shell access so I can't run GREP.

I can write a PHP scrip to do it; but, this is a one time thing and I was hoping to find something to save me the effort.

Thanks....

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

<?php shell_exec('grep ...'); ?>

--- End Message ---
--- Begin Message ---
host prohibits shell_exec()


Casey wrote:
On Apr 12, 2008, at 12:13 PM, Al <[EMAIL PROTECTED]> wrote:

I need a simple utility that simulates GREP to find a certain string in any php files on my website.

Site is on a shared host w/o shell access so I can't run GREP.

I can write a PHP scrip to do it; but, this is a one time thing and I was hoping to find something to save me the effort.

Thanks....

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

<?php shell_exec('grep ...'); ?>

--- End Message ---
--- Begin Message ---
On Sat, Apr 12, 2008 at 3:42 PM, Al <[EMAIL PROTECTED]> wrote:

> host prohibits shell_exec()


im sure you could put something together w/ php_grep();

http://www.php.net/preg-grep

-nathan

--- End Message ---
--- Begin Message ---
I know how to script one to do the job; but, I was hoping to save a few hours..



Nathan Nobbe wrote:
On Sat, Apr 12, 2008 at 3:42 PM, Al <[EMAIL PROTECTED]> wrote:

host prohibits shell_exec()


im sure you could put something together w/ php_grep();

http://www.php.net/preg-grep

-nathan


--- End Message ---
--- Begin Message ---
I am trying to create the following command with the php curl functions:

curl -F "[EMAIL PROTECTED]" "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
[EMAIL PROTECTED]

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


--- End Message ---
--- Begin Message ---
On 4/12/08, hce <[EMAIL PROTECTED]> wrote:
> On 4/12/08, Bojan Tesanovic <[EMAIL PROTECTED]> wrote:
>  > You need CLI (Comman Line interface) for PHP
>  >  most of PECL packages are in apt-get
>  >
>  >  eg apt-get php-memcache
>  >
>  >
>  >
>  >
>  >  On Apr 12, 2008, at 3:19 AM, Shawn McKenzie wrote:
>  >
>  >
>  > > hce wrote:
>  > >
>  > > > Hi,
>  > > > I post following message days ago, but could not see it on the list.
>  > > > Sorry if it is duplicated.
>  > > > I've installed php5 in debian, but got following problems:
>  > > > 1. I could not find a proper debian package for pecl, search pecl 
> found:
>  > > > dh-make-php - Creates Debian source packages for PHP PEAR and PECL
>  > extensions
>  > > > php-pear - PEAR - PHP Extension and Application Repository
>  > > > php4-imagick - ImageMagick module for php4
>  > > > php5-imagick - ImageMagick module for php5
>  > > > Could anyone who have installed php in debian advise which pecl
>  > > > package I should install in debian? I need to install the pecl using
>  > > > for memcache, lighttpd and mysql.
>  > > > 2. I installed php5 in debian, but there is only /usr/bin/php5-cgi, no
>  > > > php binary fond in /usr/bin.
>  > > > $ dpkg -l php5
>  > > > Desired=Unknown/Install/Remove/Purge/Hold
>  > > > |
>  > Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
>  > > > |/ Err?=(none)/Hold/Reinst-required/X=both-problems
>  > (Status,Err: uppercase=bad)
>  > > > ||/ Name           Version        Description
>  > > >
>  > 
> +++-==============-==============-============================================
>  > > > ii  php5           5.2.0-8+etch10 server-side, HTML-embedded scripting
>  > languag
>  > > > Which php package I have been missing for php command?
>  > > > Thank you.
>  > > > Kind Regards,
>  > > > Jim
>  > > >
>  > > Not sure about debian but ubuntu you install the individual modules, not
>  > all that are included in PECL.
>  > >
>  > > 1. apt-get install php5-mysql php5-lighttpd php5-memcache
>  > >
>  > > 2. apt-get install php5-cli
>  > >
>  > > -Shawn
>  > >
>
>
> Thanks Shawn and Bojan. I have already insalled php5-memcache,
>  php5-mysql.  What is the pecl package for the following error:
>
>  Catchable fatal error: Object of class MDB2_Error could not be
>  converted to string....

I've resolved that issue. Thank you all.

Kind Regards,

Jim

--- End Message ---

Reply via email to