php-general Digest 2 Mar 2008 02:30:58 -0000 Issue 5324

2008-03-01 Thread php-general-digest-help

php-general Digest 2 Mar 2008 02:30:58 - Issue 5324

Topics (messages 270802 through 270819):

Re: Calculating dates
270802 by: Nathan Nobbe

Re: RewriteRule help
270803 by: Greg Donald
270804 by: Per Jessen

Re: PHP on Windows
270805 by: Andrés Robinet
270806 by: chetan rane

Re: Making sure an include file works
270807 by: Daniel Brown
270808 by: Al

Pear
270809 by: movies.biblescramble.com
270813 by: Nathan Nobbe
270815 by: movies.biblescramble.com
270816 by: Nathan Nobbe
270817 by: movies.biblescramble.com
270819 by: Rick Pasotto

reading incoming xml
270810 by: Larry Brown
270811 by: Nathan Nobbe
270812 by: Larry Brown
270814 by: Nathan Nobbe

Importing and exporting from MySQL, escape slash problem
270818 by: Dave M G

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]


--
---BeginMessage---
On Sat, Mar 1, 2008 at 8:42 AM, Brice [EMAIL PROTECTED] wrote:

 I like this way too but it will not work with a date before the first
 January 1901.

 Do you have another method?


the DateTime class uses an unsigned 64 bit integer to represent the unix
timestamp internally.  as a result it can handle such dates w/o a problem.

php  $dt1 = date_create('1856-02-27');
php  $dt2 = date_create('1855-12-03');
php  echo ($dt1-format('U') - $dt2-format('U')) / 86400;
86

-nathan
---End Message---
---BeginMessage---
On 3/1/08, Shelley [EMAIL PROTECTED] wrote:
  Anybody knows what apache RewriteRule to use if  I want url:
  http://www.aaa.comm/user//
  be rewritten as:
  http://www.aaa.comm/user/index.php//


RewriteRule  ^user/([-a-zA-Z0-9]+)$   /index.php?user=$1   [NC,L]



-- 
Greg Donald
http://destiney.com/
---End Message---
---BeginMessage---
Shelley wrote:

 Hi all,
 
 Anybody knows what apache RewriteRule to use if  I want url:
 http://www.aaa.comm/user//
 be rewritten as:
 http://www.aaa.comm/user/index.php//
 

RewriteRule  /user/([^/]+)/   /user/index.php/$1/


/Per Jessen, Zürich
---End Message---
---BeginMessage---
 -Original Message-
 From: Erik SJMN [mailto:[EMAIL PROTECTED]
 Sent: Friday, February 29, 2008 9:41 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] PHP on Windows
 
 I'm completely new to php and I'm trying to setup an online trouble ticket
 system.  After the user logs in and submits the ticket, they're supposed to
 receive an email confirmation with the ticket number.  I have my Exchange
 server setup on another server in the same domain that I'm trying to use to
 send these emails - this server requires SMTP authentication.  So I've
 installed the PEAR Mail package, as it was my understanding that this would
 allow me to do the authentication for the SMTP server - I installed it in
 the C:\PHP5\PEAR directory.  Do I need this mail package for the
 authentication?  In any case, where do I setup the authentication variables
 to send this email?  I tried adding the authentication vars to the
 smtp.phpfile in the  C:\PHP5\PEAR\Mail directory, but still not
 authenticating.  I'm
 completely lost, any help is greatly appreciated.
 
 ; PHP 5.2.5 installed on Windows Server 2003 with IIS 6
 ; Mail-1.1.14 mail pkg with Net_SMTP-1.2.11 pkg
 
 --Erik

Did you try this http://email.about.com/od/emailprogrammingtips/qt/et073006.htm
?

Regards,

Rob


Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
TEL 954-607-4207 | FAX 954-337-2695 | 
Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE: bestplace |
 Web: bestplace.biz  | Web: seo-diy.com
---End Message---
---BeginMessage---
hi

try XAMMP from xampp.org it is packaged with apace PHp mysql and filezilla

On Sat, Mar 1, 2008 at 9:51 PM, Andrés Robinet [EMAIL PROTECTED]
wrote:

  -Original Message-
  From: Erik SJMN [mailto:[EMAIL PROTECTED]
  Sent: Friday, February 29, 2008 9:41 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] PHP on Windows
 
  I'm completely new to php and I'm trying to setup an online trouble
 ticket
  system.  After the user logs in and submits the ticket, they're supposed
 to
  receive an email confirmation with the ticket number.  I have my
 Exchange
  server setup on another server in the same domain that I'm trying to use
 to
  send these emails - this server requires SMTP authentication.  So I've
  installed the PEAR Mail package, as it was my understanding that this
 would
  allow me to do the authentication for the SMTP server - I installed it
 in
  the C:\PHP5\PEAR directory.  Do I need this mail package for the
  authentication?  In any case, where do I setup the authentication
 variables
  to send this email?  I tried adding the authentication 

[PHP] RewriteRule help

2008-03-01 Thread Shelley

Hi all,

Anybody knows what apache RewriteRule to use if  I want url:
http://www.aaa.comm/user//
be rewritten as:
http://www.aaa.comm/user/index.php//

It is not a php question. But now Im not in apache list and it's a 
little hurry.


Any help, thank you very much.

--
Cheers,
Shelley

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



Re: [PHP] simple command help

2008-03-01 Thread Shelley

Daniel Brown wrote:

On Fri, Feb 29, 2008 at 5:22 AM, Shelley [EMAIL PROTECTED] wrote:
  

Hi all,

 What's the command to use if I want to remove all the directories and
 files except 'a.gz' under a directory?



There isn't a command in PHP to do this.  You'd have to write a
script to handle that processing.

If you're looking for general Unix/Linux commands, you're in the
wrong place, but here's one possible way to do it:

sudo chattr +i /path/to/a.gz
rm -fR /path
sudo chattr -i /path/to/a.gz

If you have sudo access (or straight root access, in which case
you can su - to root and skip the 'sudo' part of the command), that
will set the file attribute to immutable, which means no one -
including root or the system itself - can modify or delete that file
unless they have the CAP_LINUX_IMMUTABLE capability (such as root) and
issue the 'chattr -i filename' command.

  

That's what I wanted. Thanks.
I have full priviledge of the directory.

--
Cheers,
Shelley

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



Re: [PHP] Get country from Phone number

2008-03-01 Thread Satyam


- Original Message - 
From: Jim Lucas [EMAIL PROTECTED]

To: Dani Castaños [EMAIL PROTECTED]
Cc: PHP LIST php-general@lists.php.net
Sent: Saturday, March 01, 2008 2:36 AM
Subject: Re: [PHP] Get country from Phone number



Dani Castaños wrote:

Hi all!

I'm looking for some piece of code or class which giving a phone number 
it returns me from wich country is this phone.

Do you know where I can find something like this?

Thank you in advanced!



As a little project, I took the link provided by the other Rob and make 
this little search tool.


It only looks at the beginning numbers.  It does no number validation.  I 
don't validate the length of the number.  ie: I would have to know the 
min/max lenth of each phone number for that given country/region, and I 
didn't search for that information.


You can't check for length, that depends on each national administration and 
while some countries have all phone numbers exactly the same length, some 
other countries do it the old style:  small phone exchanges have few digits, 
larger have more, which gets compensated by the smaller exchanges having 
longer area codes.


The idea is that within small towns, you dial short numbers to reach your 
neighbour and, if someone dials from outside the area, they have to dial a 
longer area code prefix, but since the town is small, there is a lesser 
chance that many people will have any business dialing them anyway so, 
overall, you get to dial less.  Also, in electromechanical phone exchanges, 
each extra digit (actually couple of digits) requires an extra row of 
'selectors', which are (were) expensive.


This still happens at the country level, not because it really matters 
nowadays but due to the existing technology when it was agreed on it.  Large 
countries in Latin America have two digit country codes (political 
maneuvering at the time of assignment distorted this somewhat, letting Peru 
and Cuba get 2 digits which don't fit their actual number of phone lines). 
Thus, from 51 to 58 they are assigned to the larger countries.  The 59x and 
50x ranges (in phone numbering the zero is after the nine within the same 
decade) go to countries with less phone lines.


Satyam




Let me know what you'll think.

http://www.cmsws.com/examples/php/areacodes/countrycodes.php

--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

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



--
No virus found in this incoming message.
Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 
269.21.2/1305 - Release Date: 29/02/2008 18:32





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



Re: [PHP] string effect

2008-03-01 Thread Richard Heyes

Mr. Heyes more or less prompted me to go dig for my other, slightly
heavier version, that doesn't chop words up:


Sorry I hit Reply instead Reply All. Regardless, here's my str_curtail. 
There is a bug in it that means if the string is all one word then it 
gets curtailed to nada, but that's easily fixed.


/**
* Shortens the given string to the specified number of characters,
* however will never shorten mid-word (going backwards to find white
* space). Appends
* ... (unless third arg is given).
*
* @param  string $strInput to shorten
* @param  int$length Length to shorten to (defaults to 35)
* @param  string $append String to append (defaults to ...)
* @return string Resulting shortened string
*/
function str_curtail($str, $length = 35, $append = '...')
{
// String short enough already ?
if (strlen($str) = $length) {
return $str;
}

$str = substr($str, 0, $length);

// No body intentionally
for ($i=$length - 1; !ctype_space($str{$i})  $i  0; --$i);

return rtrim(substr($str, 0, $i)) . $append;
}

--
Richard Heyes
Employ me:
http://www.phpguru.org/cv

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



Re: [PHP] RewriteRule help

2008-03-01 Thread Richard Heyes

Anybody knows what apache RewriteRule to use if  I want url:
http://www.aaa.comm/user//
be rewritten as:
http://www.aaa.comm/user/index.php//

It is not a php question. But now Im not in apache list and it's a 
little hurry.


If possible you could:

1. Make user a php script
2. Use the Files Apache directive to make it be parsed as a PHP script
   (http://www.phpguru.org/article.php/212)
3. Then in the user file you can use the $_SERVER['REQUEST_URI']
   to ascertain the correct content to show.

--
Richard Heyes (wondering if he's getting a bit of a reputation...)
Employ me:
http://www.phpguru.org/cv

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



Re: [PHP] Calculating dates

2008-03-01 Thread Ron Piggott
Thanks.  That's a nifty way of doing this.  Ron

On Fri, 2008-02-29 at 22:08 -0800, Jim Lucas wrote:
 Ron Piggott wrote:
  Is there an easy way to calculate the number of days between two dates?
  
  Example: 2008-02-27 - 2007-12-03 = 86 days
  
  The dates will be in the format above -MM-DD
  
  Ron
  
 
 This should do the trick
 
 ?php
 
 $date1 = '2008-02-27';
 $date2 = '2007-12-03';
 
 $udate1 = strtotime($date1);
 $udate2 = strtotime($date2);
 
 $factor = 86400;
 
 
 $difference = (($udate1 - $udate2) / $factor);
 
 echo The difference is {$difference} days;
 
 
 Jim

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



Re: [PHP] Calculating dates

2008-03-01 Thread Brice
I like this way too but it will not work with a date before the first
January 1901.

Do you have another method?

Brice Favre



On Sat, Mar 1, 2008 at 7:08 AM, Jim Lucas [EMAIL PROTECTED] wrote:
 Ron Piggott wrote:
   Is there an easy way to calculate the number of days between two dates?
  
   Example: 2008-02-27 - 2007-12-03 = 86 days
  
   The dates will be in the format above -MM-DD
  
   Ron
  

  This should do the trick

  ?php

  $date1 = '2008-02-27';
  $date2 = '2007-12-03';

  $udate1 = strtotime($date1);
  $udate2 = strtotime($date2);

  $factor = 86400;


  $difference = (($udate1 - $udate2) / $factor);

  echo The difference is {$difference} days;


  Jim




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



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



Re: [PHP] RewriteRule help

2008-03-01 Thread Greg Donald
On 3/1/08, Shelley [EMAIL PROTECTED] wrote:
  Anybody knows what apache RewriteRule to use if  I want url:
  http://www.aaa.comm/user//
  be rewritten as:
  http://www.aaa.comm/user/index.php//


RewriteRule  ^user/([-a-zA-Z0-9]+)$   /index.php?user=$1   [NC,L]



-- 
Greg Donald
http://destiney.com/

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



Re: [PHP] Calculating dates

2008-03-01 Thread Nathan Nobbe
On Sat, Mar 1, 2008 at 8:42 AM, Brice [EMAIL PROTECTED] wrote:

 I like this way too but it will not work with a date before the first
 January 1901.

 Do you have another method?


the DateTime class uses an unsigned 64 bit integer to represent the unix
timestamp internally.  as a result it can handle such dates w/o a problem.

php  $dt1 = date_create('1856-02-27');
php  $dt2 = date_create('1855-12-03');
php  echo ($dt1-format('U') - $dt2-format('U')) / 86400;
86

-nathan


Re: [PHP] RewriteRule help

2008-03-01 Thread Per Jessen
Shelley wrote:

 Hi all,
 
 Anybody knows what apache RewriteRule to use if  I want url:
 http://www.aaa.comm/user//
 be rewritten as:
 http://www.aaa.comm/user/index.php//
 

RewriteRule  /user/([^/]+)/   /user/index.php/$1/


/Per Jessen, Zürich

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



RE: [PHP] PHP on Windows

2008-03-01 Thread Andrés Robinet
 -Original Message-
 From: Erik SJMN [mailto:[EMAIL PROTECTED]
 Sent: Friday, February 29, 2008 9:41 PM
 To: php-general@lists.php.net
 Subject: [PHP] PHP on Windows
 
 I'm completely new to php and I'm trying to setup an online trouble ticket
 system.  After the user logs in and submits the ticket, they're supposed to
 receive an email confirmation with the ticket number.  I have my Exchange
 server setup on another server in the same domain that I'm trying to use to
 send these emails - this server requires SMTP authentication.  So I've
 installed the PEAR Mail package, as it was my understanding that this would
 allow me to do the authentication for the SMTP server - I installed it in
 the C:\PHP5\PEAR directory.  Do I need this mail package for the
 authentication?  In any case, where do I setup the authentication variables
 to send this email?  I tried adding the authentication vars to the
 smtp.phpfile in the  C:\PHP5\PEAR\Mail directory, but still not
 authenticating.  I'm
 completely lost, any help is greatly appreciated.
 
 ; PHP 5.2.5 installed on Windows Server 2003 with IIS 6
 ; Mail-1.1.14 mail pkg with Net_SMTP-1.2.11 pkg
 
 --Erik

Did you try this http://email.about.com/od/emailprogrammingtips/qt/et073006.htm
?

Regards,

Rob


Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
TEL 954-607-4207 | FAX 954-337-2695 | 
Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE: bestplace |
 Web: bestplace.biz  | Web: seo-diy.com

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



Re: [PHP] PHP on Windows

2008-03-01 Thread chetan rane
hi

try XAMMP from xampp.org it is packaged with apace PHp mysql and filezilla

On Sat, Mar 1, 2008 at 9:51 PM, Andrés Robinet [EMAIL PROTECTED]
wrote:

  -Original Message-
  From: Erik SJMN [mailto:[EMAIL PROTECTED]
  Sent: Friday, February 29, 2008 9:41 PM
  To: php-general@lists.php.net
  Subject: [PHP] PHP on Windows
 
  I'm completely new to php and I'm trying to setup an online trouble
 ticket
  system.  After the user logs in and submits the ticket, they're supposed
 to
  receive an email confirmation with the ticket number.  I have my
 Exchange
  server setup on another server in the same domain that I'm trying to use
 to
  send these emails - this server requires SMTP authentication.  So I've
  installed the PEAR Mail package, as it was my understanding that this
 would
  allow me to do the authentication for the SMTP server - I installed it
 in
  the C:\PHP5\PEAR directory.  Do I need this mail package for the
  authentication?  In any case, where do I setup the authentication
 variables
  to send this email?  I tried adding the authentication vars to the
  smtp.phpfile in the  C:\PHP5\PEAR\Mail directory, but still not
  authenticating.  I'm
  completely lost, any help is greatly appreciated.
 
  ; PHP 5.2.5 installed on Windows Server 2003 with IIS 6
  ; Mail-1.1.14 mail pkg with Net_SMTP-1.2.11 pkg
 
  --Erik

 Did you try this
 http://email.about.com/od/emailprogrammingtips/qt/et073006.htm
 ?

 Regards,

 Rob


 Andrés Robinet | Lead Developer | BESTPLACE CORPORATION
 5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL
 33308 |
 TEL 954-607-4207 | FAX 954-337-2695 |
 Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE:
 bestplace |
  Web: bestplace.biz  | Web: seo-diy.com

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




-- 
Have A pleasant Day
Chetan. D. Rane
Location: India
Contact: +91-9986057255
other ID: [EMAIL PROTECTED]
[EMAIL PROTECTED]


Re: [PHP] Making sure an include file works

2008-03-01 Thread Daniel Brown
On Fri, Feb 29, 2008 at 10:02 PM, Richard S. Crawford
[EMAIL PROTECTED] wrote:
 On Friday 29 February 2008 11:58:16 Daniel Brown wrote:
   Get a new host that knows how to administer a web server.  PHP 4.3
   was released 27 December, 2002, with the latest from the 4.3 branch
   (4.3.11) being released 31 March, 2005.  The CHANGELOG should give you
   an idea of how *horrible* this is: http://www.php.net/ChangeLog-4.php

  Ah, if only I could.  The choice of host was made by my boss, and he loves
  them.

And if they truly love him in return, they'll let him go

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

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



[PHP] Re: Making sure an include file works

2008-03-01 Thread Al

Put this at the top of of your include files

// *** Debug Only ***/
if(TRUE) // TRUE for debug only
{
ini_set(display_errors, on); //use off if users will see them
error_reporting(E_ALL);

echo 'span style=color:redError display and logging on/span  ';
//This reminds you to turn it off when done
}

Richard S. Crawford wrote:
I'm trying to figure out a way to make sure an included PHP file has no syntax 
errors before actually including it as a part of project. Is this even 
possible?  I'm running into brick walls.




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



[PHP] Pear

2008-03-01 Thread movies
Dear PHP List Experts,

I'm trying to use Pear at my host, Leadhoster.

This line:

require_once('DB.php');

Gets this error:

Warning: main(DB.php): failed to open stream: No such file or directory in
/home/www/everoriginal.onlinewebshop.net/connect04.php on line 4

Fatal error: main(): Failed opening required 'DB.php'
(include_path='.:/usr/local/php4/share/pear') in
/home/www/everoriginal.onlinewebshop.net/connect04.php on line 4

I suspect I need to set up a path to Pear. If so, any help would be
appreciated.

This program:
?php
phpinfo();
?
seems to indicate that Pear is there.

This is my first post to this list, so please let me know if I'm not doing
it right. I couldn't find the archive, so I guess consider that my second
question.

Thanks in advance!

Jerry Kassebaum

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



[PHP] reading incoming xml

2008-03-01 Thread Larry Brown
I am running apache with php.  I set up a curl script to send an xml
request to the php page I'm authoring and want to handle the xml on the
incoming message.  My $_POST array is empty though.  Is there some other
place I should be looking?  $_SERVER shows the incoming message as a
post but again the data isn't there.  Does apache/php place the xml in
some other location for me to access?

Larry

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



Re: [PHP] reading incoming xml

2008-03-01 Thread Nathan Nobbe
On Sat, Mar 1, 2008 at 4:12 PM, Larry Brown 
[EMAIL PROTECTED] wrote:

 I am running apache with php.  I set up a curl script to send an xml
 request to the php page


did you use a request header to somehow set a mime type to indicate youre
looking for xml?  could you show us this request, im not sure how to request
for xml specifically..


 My $_POST array is empty though.


 is this on the system where the xml will be sent from?  you have to
populate the post fields in the request by using the curl option
CURLOPT_POST to indicate you are posting, and CURLOPT_POSTFIELDS, to pass an
array of parameters that will be used as post fields.  then the $_POST array
will be populated on the provider system.

 Is there some other
 place I should be looking?  $_SERVER shows the incoming message as a
 post but again the data isn't there.


still curious if youre looking on the consumer (system sending curl request)
or the provider, (system providing the xml data via response).


  Does apache/php place the xml in
 some other location for me to access?


depending on how you configure curl, the data can be in different places.
the easiest way (i think) is to use the CURLOPT_RETURNTRANSFER option.  then
the response will be returned from curl_exec() (rather than a boolean
success flag).

here is sample code from a consumer and a provider; theyre up on my server
so you can try using the consumer if you want.

CONSUMER
---
?php
$curlHandle = curl_init('http://nathan.moxune.com/postXml.php');
curl_setopt_array($curlHandle, array(
CURLOPT_RETURNTRANSFER = true,
CURLOPT_POST = true,
CURLOPT_POSTFIELDS = array(
'token' = 1
)
));

$response = curl_exec($curlHandle);
if(!empty($response)) {
try {
$sxml = new SimpleXmlElement($response);
echo $sxml-asXML();
} catch(Exception $e) {
die($e-getMessage());
}
}
?

PROVIDER
-
?php
if($_POST['token'] == 1) { ?
someString
moreHere
lessHere /
/moreHere
/someString
?php } ?

-nathan


Re: [PHP] reading incoming xml

2008-03-01 Thread Larry Brown
I'm sending from a php cli with:

$post = '?xml version=1.0
encoding=UTF-8?Data'.$vendorCompanyID.'/Data';

$message = generatePage($page, $post);  
  
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'https://myserver/mytestpage.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 4);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $message);

$data=curl_exec($ch);


I've the server page (mytestpage.php) set up as:

echo hello\n;

print_r($_SERVER);

where I replace SERVER with POST etc and I can't find the string '?xml
version=1.0 encoding=UTF-8?Data'.$vendorCompanyID.'/Data' in
the $data output.  I do get the hello so I know I am hitting the server
and when it is set to $_SERVER as listed above I get the expected array
but $_POST is empty.

Larry

On Sat, 2008-03-01 at 16:59 -0500, Nathan Nobbe wrote:
 On Sat, Mar 1, 2008 at 4:12 PM, Larry Brown 
 [EMAIL PROTECTED] wrote:
 
  I am running apache with php.  I set up a curl script to send an xml
  request to the php page
 
 
 did you use a request header to somehow set a mime type to indicate youre
 looking for xml?  could you show us this request, im not sure how to request
 for xml specifically..
 
 
  My $_POST array is empty though.
 
 
  is this on the system where the xml will be sent from?  you have to
 populate the post fields in the request by using the curl option
 CURLOPT_POST to indicate you are posting, and CURLOPT_POSTFIELDS, to pass an
 array of parameters that will be used as post fields.  then the $_POST array
 will be populated on the provider system.
 
  Is there some other
  place I should be looking?  $_SERVER shows the incoming message as a
  post but again the data isn't there.
 
 
 still curious if youre looking on the consumer (system sending curl request)
 or the provider, (system providing the xml data via response).
 
 
   Does apache/php place the xml in
  some other location for me to access?
 
 
 depending on how you configure curl, the data can be in different places.
 the easiest way (i think) is to use the CURLOPT_RETURNTRANSFER option.  then
 the response will be returned from curl_exec() (rather than a boolean
 success flag).
 
 here is sample code from a consumer and a provider; theyre up on my server
 so you can try using the consumer if you want.
 
 CONSUMER
 ---
 ?php
 $curlHandle = curl_init('http://nathan.moxune.com/postXml.php');
 curl_setopt_array($curlHandle, array(
 CURLOPT_RETURNTRANSFER = true,
 CURLOPT_POST = true,
 CURLOPT_POSTFIELDS = array(
 'token' = 1
 )
 ));
 
 $response = curl_exec($curlHandle);
 if(!empty($response)) {
 try {
 $sxml = new SimpleXmlElement($response);
 echo $sxml-asXML();
 } catch(Exception $e) {
 die($e-getMessage());
 }
 }
 ?
 
 PROVIDER
 -
 ?php
 if($_POST['token'] == 1) { ?
 someString
 moreHere
 lessHere /
 /moreHere
 /someString
 ?php } ?
 
 -nathan
-- 
Larry Brown [EMAIL PROTECTED]

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



Re: [PHP] Pear

2008-03-01 Thread Nathan Nobbe
On Sat, Mar 1, 2008 at 3:41 PM, [EMAIL PROTECTED] wrote:

 Dear PHP List Experts,

 I'm trying to use Pear at my host, Leadhoster.

 This line:

 require_once('DB.php');

 Gets this error:

 Warning: main(DB.php): failed to open stream: No such file or directory in
 /home/www/everoriginal.onlinewebshop.net/connect04.php on line 4

 Fatal error: main(): Failed opening required 'DB.php'
 (include_path='.:/usr/local/php4/share/pear') in
 /home/www/everoriginal.onlinewebshop.net/connect04.php on line 4


maybe try

find /usr/local/php4/share/pear -name 'DB.php'

to see if you have that component of pear installed.  pear is a component
based system, which means even if you have pear installed, there are tons of
libraries you can use it to install.  if you type

pear info DB

and nothing comes up, then likely you need to install it with

pear install DB


also, regarding the archives, i think there are several archives out there,
i always look at marc tho; http://marc.info/?l=php-general

-nathan


Re: [PHP] reading incoming xml

2008-03-01 Thread Nathan Nobbe
On Sat, Mar 1, 2008 at 5:17 PM, Larry Brown 
[EMAIL PROTECTED] wrote:

 I'm sending from a php cli with:

 $post = '?xml version=1.0
 encoding=UTF-8?Data'.$vendorCompanyID.'/Data';

 $message = generatePage($page, $post);

 $ch = curl_init();
 curl_setopt($ch, 
 CURLOPT_URL,'https://myserver/mytestpage.php'https://myserver/mytestpage.php%27
 );
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 curl_setopt($ch, CURLOPT_TIMEOUT, 4);
 curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $message);

 $data=curl_exec($ch);


 I've the server page (mytestpage.php) set up as:

 echo hello\n;

 print_r($_SERVER);

 where I replace SERVER with POST etc and I can't find the string '?xml
 version=1.0 encoding=UTF-8?Data'.$vendorCompanyID.'/Data' in
 the $data output.  I do get the hello so I know I am hitting the server
 and when it is set to $_SERVER as listed above I get the expected array
 but $_POST is empty.


hmm,  it looks to me like you want to post a bunch of raw data to the
server.  im not sure exactly how to do that w/ the php curl functions...
everything ive seen uses CURLOPT_POSTFIELDS to supply an associative array
of data to be posted.  in this case you could easily send you data across by
choosing a name for the index, something like 'postdata', anything will do,
then it will be accessible on the system youre posting to via
$_POST['postdata'].

also, inlooking at your usage of CURLOPT_CUSTOMREQUEST, i dont believe youre
using it correctly,  i think youre just supposed to put a string
representing the desired http method in there, so something like 'HEAD',
'PUT', or in this case 'POST'.  then you would supply the data as i said
earlier, using CURLOPT_POSTFIELDS.  so in all, i think something like this
would work for you,

$post = '?xml version=1.0
encoding=UTF-8?Data'.

 $vendorCompanyID.'/Data';

 $message = generatePage($page, $post);

 $ch = curl_init();
 curl_setopt($ch, 
 CURLOPT_URL,'https://myserver/mytestpage.php'https://myserver/mytestpage.php%27
 );
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 curl_setopt($ch, CURLOPT_TIMEOUT, 4);
 curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');

curl_setopt($ch, CURLOPT_POSTFIELDS, array('postdata' = $message));


 $data=curl_exec($ch);


and also, in reading the warning about CURLOPT_CUSTOMREQUEST, you might just
go with CURLOPT_POST = true, since you arent using an obscure http method.
im not sure exactly how to determine if the server supports this method or
not.  anyway, i found this in 'man curl_easy_setopt'  (thats the manpage for
the c function php uses for the CURLOPT_CUSTOMREQUEST option).

  Many people have wrongly used this option to replace the
entire request with their own, including multiple headers and POST contents.
While that  might
  work  in  many  cases,  it will cause libcurl to send invalid
requests and it could possibly confuse the remote server badly. Use
CURLOPT_POST and CUR-
  LOPT_POSTFIELDS to set POST data. Use CURLOPT_HTTPHEADER to
replace or extend the set of headers sent by libcurl. Use
CURLOPT_HTTP_VERSION  to  change
  HTTP version.

-nathan


Re: [PHP] Pear

2008-03-01 Thread movies
Thanks for your help, Nathan!

 maybe try

 find /usr/local/php4/share/pear -name 'DB.php'

I tried putting that in my script, and got:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in
/home/www/everoriginal.onlinewebshop.net/connect04.php on line 6

I'm thinking find is a Linux or Unix command to run on my host's
machine. I'm hoping that I can get this solved without getting Putty set
up, but am willing to make the effort if necessary.

Doesn't this error:

Fatal error: main(): Failed opening required 'DB.php'
(include_path='.:/usr/local/php4/share/pear') in
/home/www/everoriginal.onlinewebshop.net/connect04.php on line 4

show that Pear is there, and where to find it?

 if you type

 pear info DB

 and nothing comes up, then likely you need to install it with

 pear install DB

Likewise, that is from the Linux or Unix command line, right? If Pear is
not installed, wouldn't the host have to do that? Or is that something
customers can do when they have a host?

 also, regarding the archives, i think there are several archives out
 there,
 i always look at marc tho; http://marc.info/?l=php-general

Thanks!

Jerry Kassebaum

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



Re: [PHP] Pear

2008-03-01 Thread Nathan Nobbe
On Sat, Mar 1, 2008 at 6:24 PM, [EMAIL PROTECTED] wrote:

 Thanks for your help, Nathan!

  maybe try
 
  find /usr/local/php4/share/pear -name 'DB.php'

 I tried putting that in my script, and got:

 Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in
 /home/www/everoriginal.onlinewebshop.net/connect04.php on line 6

 I'm thinking find is a Linux or Unix command to run on my host's
 machine. I'm hoping that I can get this solved without getting Putty set
 up, but am willing to make the effort if necessary.


yes, find is a *nix command.  it will recursively search the filesystem from
the specified point for the pattern (in this case 'Db.php').


 Doesn't this error:

 Fatal error: main(): Failed opening required 'DB.php'
 (include_path='.:/usr/local/php4/share/pear') in
 /home/www/everoriginal.onlinewebshop.net/connect04.php on line 4

 show that Pear is there, and where to find it?


it does indicate that there is an include path w/ pear as one of the
directories, which strongly suggests that pear is installed, but it does not
absolutely garuntee it.  when you run you phpinfo script that you mentioned
in your first post, do you see pear in one of the sections there (not just
in the include path)?  also, as i said pear is a modular system, so even if
pear is installed, the DB package may not be installed.


  if you type
 
  pear info DB
 
  and nothing comes up, then likely you need to install it with
 
  pear install DB

 Likewise, that is from the Linux or Unix command line, right? If Pear is
 not installed, wouldn't the host have to do that? Or is that something
 customers can do when they have a host?


yes, you will have to use putty to connect to the host and issue unix
commands if you want to get to the bottom of this w/o emails or a phone call
to your host.  the find command is a crude way to determine if the pear DB
package is installed.  you are likely better off to use the pear cli program
to determine if its installed as in above.

-nathan


Re: [PHP] Pear

2008-03-01 Thread movies
 when you run you phpinfo script that you mentioned
 in your first post, do you see pear in one of the sections there (not just
 in the include path)?

A search on pear only yields this line:
include_path.:/usr/local/php4/share/pear.:/usr/local/php4/share/pear

Here is the page, so you can check it out if you want:

http://everoriginal.onlinewebshop.net/phpInfo.php

 also, as i said pear is a modular system, so even
 if
 pear is installed, the DB package may not be installed.

Is there something I could include from pear that would have an
extremely high possibility of being installed?

 yes, you will have to use putty to connect to the host and issue unix
 commands if you want to get to the bottom of this

Probably a good idea anyway, eh? I'll work on it...

...SSH Manager section is not available for your hosting plan!

I get free hosting at this place. I'd like to test it out before I buy,
but maybe I'll just have to bite the bullet.

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



[PHP] Importing and exporting from MySQL, escape slash problem

2008-03-01 Thread Dave M G

PHP List, MySQL List

In my PHP environment, I have Magic Quotes turned off, and I use the 
mysql_real_escape_string() function clean strings of SQL syntax before 
inserting them into my database.


So the data stored in my database does not have escape characters in it. 
Particularly, double and single quotes don't have slashes in front of them.


This seems to work fine so long as I'm reading data into and out of the 
database from within my scripts.


However, when I backup and import databases - I use the phpMyAdmin 
interface - they have escape slashes in front of every double and single 
quote characters. I'm not sure if it's on the export or import where 
they get added in.


I've looked through the phpMyAdmin online documentation, and I can't see 
any option to control the presence of escape slashes. It seems to me 
that if it adds them in when exporting, it should take them out when 
importing. Or vice versa, but in either case be consistent.


I just want my database to be exactly as it is before any export or 
import options.


I'm a little muddled as to where I'm making the mistake. Can anyone 
advice on the best practice for preserving my database as is when 
backing up and restoring?


Thanks for any advice.

--
Dave M G

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



Re: [PHP] Pear

2008-03-01 Thread Rick Pasotto
It is quite possible (ie, I've done it) to install the PEAR modules you
need within your own web space. You just have to get the directory
structure and your include line right.

The PEAR system is just a bunch of php files so if you've got php you've
got all you really need.

-- 
... most legislators ... as they rarely make any moral distinctions,
 they are as likely to serve the devil, without intending it, as God.
-- Henry David Thoreau
Rick Pasotto[EMAIL PROTECTED]http://www.niof.net

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



Re: [PHP] reading incoming xml

2008-03-01 Thread Larry Brown
Thanks for the help Nathan.  What I'm looking for though is how to
accept and read the incoming XML the way I was sending it in curl.  I am
currently using that curl mechanism on the cli to connect to another
remote XML server successfully.  I want to keep that side of the
equation the same.  I need to find out if I can access the incoming data
on the server side.  I don't need or want to use curl on the server
side.  I just want to handle the incoming XML.

How does SOAP and XML-RPC get to the incoming XML?  Is the incoming SOAP
and XML-RPC packages arriving in html posts?  I tried looking at the
nusoap code to determine this to no avail.

Larry

On Sat, 2008-03-01 at 18:08 -0500, Nathan Nobbe wrote:

 hmm,  it looks to me like you want to post a bunch of raw data to the
 server.  im not sure exactly how to do that w/ the php curl functions...
 everything ive seen uses CURLOPT_POSTFIELDS to supply an associative array
 of data to be posted.  in this case you could easily send you data across by
 choosing a name for the index, something like 'postdata', anything will do,
 then it will be accessible on the system youre posting to via
 $_POST['postdata'].
 
 also, inlooking at your usage of CURLOPT_CUSTOMREQUEST, i dont believe youre
 using it correctly,  i think youre just supposed to put a string
 representing the desired http method in there, so something like 'HEAD',
 'PUT', or in this case 'POST'.  then you would supply the data as i said
 earlier, using CURLOPT_POSTFIELDS.  so in all, i think something like this
 would work for you,
 

 
 
 and also, in reading the warning about CURLOPT_CUSTOMREQUEST, you might just
 go with CURLOPT_POST = true, since you arent using an obscure http method.
 im not sure exactly how to determine if the server supports this method or
 not.  anyway, i found this in 'man curl_easy_setopt'  (thats the manpage for
 the c function php uses for the CURLOPT_CUSTOMREQUEST option).
 
   Many people have wrongly used this option to replace the
 entire request with their own, including multiple headers and POST contents.
 While that  might
   work  in  many  cases,  it will cause libcurl to send invalid
 requests and it could possibly confuse the remote server badly. Use
 CURLOPT_POST and CUR-
   LOPT_POSTFIELDS to set POST data. Use CURLOPT_HTTPHEADER to
 replace or extend the set of headers sent by libcurl. Use
 CURLOPT_HTTP_VERSION  to  change
   HTTP version.
 
 -nathan
-- 
Larry Brown [EMAIL PROTECTED]

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



Re: [PHP] reading incoming xml

2008-03-01 Thread Larry Brown
The incoming message to the server is:

POST /vendorXML.html HTTP/1.0
MIME-Version: 1.0
Content-type: text/html
Content-length: 114
Content-transfer-encoding: text
Request-number: 1
Document-type: Request
Interface-Version: Test 1.4
Connection: close

?xml version=1.0 encoding=UTF-8?DatavendorCompanyID/Data


Larry

On Sat, 2008-03-01 at 18:08 -0500, Nathan Nobbe wrote:

 hmm,  it looks to me like you want to post a bunch of raw data to the
 server.  im not sure exactly how to do that w/ the php curl functions...
 everything ive seen uses CURLOPT_POSTFIELDS to supply an associative array
 of data to be posted.  in this case you could easily send you data across by
 choosing a name for the index, something like 'postdata', anything will do,
 then it will be accessible on the system youre posting to via
 $_POST['postdata'].
 
 also, inlooking at your usage of CURLOPT_CUSTOMREQUEST, i dont believe youre
 using it correctly,  i think youre just supposed to put a string
 representing the desired http method in there, so something like 'HEAD',
 'PUT', or in this case 'POST'.  then you would supply the data as i said
 earlier, using CURLOPT_POSTFIELDS.  so in all, i think something like this
 would work for you,
 

 
 
 and also, in reading the warning about CURLOPT_CUSTOMREQUEST, you might just
 go with CURLOPT_POST = true, since you arent using an obscure http method.
 im not sure exactly how to determine if the server supports this method or
 not.  anyway, i found this in 'man curl_easy_setopt'  (thats the manpage for
 the c function php uses for the CURLOPT_CUSTOMREQUEST option).
 
   Many people have wrongly used this option to replace the
 entire request with their own, including multiple headers and POST contents.
 While that  might
   work  in  many  cases,  it will cause libcurl to send invalid
 requests and it could possibly confuse the remote server badly. Use
 CURLOPT_POST and CUR-
   LOPT_POSTFIELDS to set POST data. Use CURLOPT_HTTPHEADER to
 replace or extend the set of headers sent by libcurl. Use
 CURLOPT_HTTP_VERSION  to  change
   HTTP version.
 
 -nathan
-- 
Larry Brown [EMAIL PROTECTED]

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



Re: [PHP] reading incoming xml

2008-03-01 Thread Daniel Brown
On Sat, Mar 1, 2008 at 9:33 PM, Larry Brown
[EMAIL PROTECTED] wrote:
 Thanks for the help Nathan.  What I'm looking for though is how to
  accept and read the incoming XML the way I was sending it in curl.  I am
  currently using that curl mechanism on the cli to connect to another
  remote XML server successfully.  I want to keep that side of the
  equation the same.  I need to find out if I can access the incoming data
  on the server side.  I don't need or want to use curl on the server
  side.  I just want to handle the incoming XML.

Larry,

I'm sorry that I'm not certain what you mean by remote XML
server, since XML is a markup language and a server (in this context)
insinuates an HTTP (protocol) web server, but perhaps a combination of
file_get_contents() and the information from the following manual
entry will help you.

http://www.php.net/xml

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

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



RE: [PHP] reading incoming xml

2008-03-01 Thread Andrés Robinet
You can get what you post either with:

$postText = trim(file_get_contents('php://input');

Or with:

$postText = $GLOBALS[HTTP_RAW_POST_DATA];

About HTTP_RAW_POST_DATA http://us2.php.net/manual/en/reserved.variables.php
Read the notes here http://us2.php.net/variables.predefined

It should be noted that $HTTP_RAW_POST_DATA only exists if the encoding type of
the data is -not- the default of application/x-www.form-urlencoded, and so, to
accessing raw post data from an HTTP form requires setting enctype= in your
HTML. 

So, if $RAW_POST_DATA doesn't exist, it is because you should be able to use
$_POST (unless you set PHP to always populate raw post data in php.ini). The
preferred method is, however, to read 'php://input'

Then after you get the XML body, you must use one of the XML extensions
available in PHP to parse the XML data (search for it as it's not part of this
help pack ;) ).

Regards,

Rob(inet)

Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
TEL 954-607-4207 | FAX 954-337-2695 | 
Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE: bestplace |
 Web: bestplace.biz  | Web: seo-diy.com

 -Original Message-
 From: Larry Brown [mailto:[EMAIL PROTECTED]
 Sent: Saturday, March 01, 2008 9:43 PM
 To: Nathan Nobbe
 Cc: php
 Subject: Re: [PHP] reading incoming xml
 
 The incoming message to the server is:
 
 POST /vendorXML.html HTTP/1.0
 MIME-Version: 1.0
 Content-type: text/html
 Content-length: 114
 Content-transfer-encoding: text
 Request-number: 1
 Document-type: Request
 Interface-Version: Test 1.4
 Connection: close
 
 ?xml version=1.0 encoding=UTF-8?DatavendorCompanyID/Data
 
 
 Larry
 
 On Sat, 2008-03-01 at 18:08 -0500, Nathan Nobbe wrote:
 
  hmm,  it looks to me like you want to post a bunch of raw data to the
  server.  im not sure exactly how to do that w/ the php curl functions...
  everything ive seen uses CURLOPT_POSTFIELDS to supply an associative
 array
  of data to be posted.  in this case you could easily send you data across
 by
  choosing a name for the index, something like 'postdata', anything will
 do,
  then it will be accessible on the system youre posting to via
  $_POST['postdata'].
 
  also, inlooking at your usage of CURLOPT_CUSTOMREQUEST, i dont believe
 youre
  using it correctly,  i think youre just supposed to put a string
  representing the desired http method in there, so something like 'HEAD',
  'PUT', or in this case 'POST'.  then you would supply the data as i said
  earlier, using CURLOPT_POSTFIELDS.  so in all, i think something like
 this
  would work for you,
 
 
 
 
  and also, in reading the warning about CURLOPT_CUSTOMREQUEST, you might
 just
  go with CURLOPT_POST = true, since you arent using an obscure http
 method.
  im not sure exactly how to determine if the server supports this method
 or
  not.  anyway, i found this in 'man curl_easy_setopt'  (thats the manpage
 for
  the c function php uses for the CURLOPT_CUSTOMREQUEST option).
 
Many people have wrongly used this option to replace the
  entire request with their own, including multiple headers and POST
 contents.
  While that  might
work  in  many  cases,  it will cause libcurl to send
 invalid
  requests and it could possibly confuse the remote server badly. Use
  CURLOPT_POST and CUR-
LOPT_POSTFIELDS to set POST data. Use CURLOPT_HTTPHEADER to
  replace or extend the set of headers sent by libcurl. Use
  CURLOPT_HTTP_VERSION  to  change
HTTP version.
 
  -nathan
 --
 Larry Brown [EMAIL PROTECTED]
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

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



Re: [PHP] reading incoming xml

2008-03-01 Thread Nathan Nobbe
On Sat, Mar 1, 2008 at 9:33 PM, Larry Brown 
[EMAIL PROTECTED] wrote:

 Thanks for the help Nathan.  What I'm looking for though is how to
 accept and read the incoming XML the way I was sending it in curl.  I am
 currently using that curl mechanism on the cli to connect to another
 remote XML server successfully.  I want to keep that side of the
 equation the same.  I need to find out if I can access the incoming data
 on the server side.  I don't need or want to use curl on the server
 side.  I just want to handle the incoming XML.

 How does SOAP and XML-RPC get to the incoming XML?  Is the incoming SOAP
 and XML-RPC packages arriving in html posts?  I tried looking at the
 nusoap code to determine this to no avail.


im sorry to say this larry, but at this point im a little bit confused.  as
dan said, xml is a markup language not a protocol, and as i said there are 2
ways to send data using an HTTP POST request and curl, per my previous
post.  the only thing youd have to do is come up w/ an index for the array
you supply to the curl option CURLOPT_POSTFIELDS and viola, you will have
the data available in the $_POST array on the server you are posting to via
curl.
you can also try what Rob said as well to grab the raw POST response.
however, im not sure i would use CURLOPT_CUSTOMREQUEST in the way you are,
in fact im surprised its even generating a POST request, because i dont see
how youve specified it in your request, and GET is the default curl HTTP
request method.
im also a little lost when you say you dont want to use curl on the server
side.  if you used CURLOPT_POSTFIELDS (on the 'client side') as i
recommended in my previous post all you have to do is grab the response from
the $_POST array on the 'server side', ergo no curl involved server side.
so, in summary, im not trying to be rude, im just trying to get on the same
page, lingo wise, and understand what was insufficient about my previous
suggestion.

-nathan


Re: [PHP] Pear

2008-03-01 Thread Nathan Nobbe
On Sat, Mar 1, 2008 at 7:57 PM, [EMAIL PROTECTED] wrote:

  when you run you phpinfo script that you mentioned
  in your first post, do you see pear in one of the sections there (not
 just
  in the include path)?

 A search on pear only yields this line:
 include_path.:/usr/local/php4/share/pear
  .:/usr/local/php4/share/pear

 Here is the page, so you can check it out if you want:

 http://everoriginal.onlinewebshop.net/phpInfo.php


yikes, php4 !?  if they dont host php5 that could be reason enough to
switch, *ducks*.  also, it looks like they have exec() disabled, but not
shell_exec(), so you could probly use that to run the find command from
earlier if you wanted to.


  also, as i said pear is a modular system, so even
  if
  pear is installed, the DB package may not be installed.

 Is there something I could include from pear that would have an
 extremely high possibility of being installed?


im not sure, but i dont think so.  you may be able to use php functions to
search the directory structure beneath the include path youve already
posted, however, this is just a lame solution that wont really accomplish
much.

 yes, you will have to use putty to connect to the host and issue unix
  commands if you want to get to the bottom of this

 Probably a good idea anyway, eh? I'll work on it...


ftp only access drive me nuts ;)


 ...SSH Manager section is not available for your hosting plan!

 I get free hosting at this place. I'd like to test it out before I buy,
 but maybe I'll just have to bite the bullet.


ouch :D

as Rick said in a later post the pear libraries are just php files.  but
installing them into your webroot manually has a couple of caveats,

   1. pain in the ass compared to using pear cli program
   2. you expose these library files to the public unless you add a
   .htaccess file to the server to protect them

but you would have the benefit of controlling the version of these libraries
you were using.  also, in that case youll want to override the include_path
setting using a .htaccess file so that if there are any pear packages
installed by the hosting company, youre scripts will use the ones in the
pear installation directory you create.

-nathan


RE: [PHP] reading incoming xml

2008-03-01 Thread Larry Brown
This is what I was looking for.  Thank you.  I could not change the
client since that client is being used for other servers in its current
configuration.  All I needed was a way to get to the XML string coming
in.  

$postText = trim(file_get_contents('php://input');

worked perfectly.  Now that I have this blob of XML I can give it to
simpleXML or another parser I was recently shown to work with it.  I'm
surprised it was so difficult to find.  $GLOBALS['HTTP_RAW_POST_DATA']
was empty by the way and that I'd seen before.

Also, sorry if I threw anyone off by referring to the other server the
client works with as an XML server.  I only referred to it as such
because it is a server that accepts XML input and responds with XML
output to a number of clients.  It is not used as a typical html server
for browsing etc.  

Anyway, I was looking to get a hold of the raw data coming in and it
looks like this was it.  I really do appreciate the help...

Larry


On Sat, 2008-03-01 at 22:06 -0500, Andrés Robinet wrote:
 You can get what you post either with:
 
 $postText = trim(file_get_contents('php://input');
 
 Or with:
 
 $postText = $GLOBALS[HTTP_RAW_POST_DATA];
 
 About HTTP_RAW_POST_DATA http://us2.php.net/manual/en/reserved.variables.php
 Read the notes here http://us2.php.net/variables.predefined
 
 It should be noted that $HTTP_RAW_POST_DATA only exists if the encoding type 
 of
 the data is -not- the default of application/x-www.form-urlencoded, and so, to
 accessing raw post data from an HTTP form requires setting enctype= in your
 HTML. 
 
 So, if $RAW_POST_DATA doesn't exist, it is because you should be able to use
 $_POST (unless you set PHP to always populate raw post data in php.ini). The
 preferred method is, however, to read 'php://input'
 
 Then after you get the XML body, you must use one of the XML extensions
 available in PHP to parse the XML data (search for it as it's not part of this
 help pack ;) ).
 
 Regards,
 
 Rob(inet)
 
 Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 
 5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
 TEL 954-607-4207 | FAX 954-337-2695 | 
 Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE: bestplace |
  Web: bestplace.biz  | Web: seo-diy.com
 
  -Original Message-
  From: Larry Brown [mailto:[EMAIL PROTECTED]
  Sent: Saturday, March 01, 2008 9:43 PM
  To: Nathan Nobbe
  Cc: php
  Subject: Re: [PHP] reading incoming xml
  
  The incoming message to the server is:
  
  POST /vendorXML.html HTTP/1.0
  MIME-Version: 1.0
  Content-type: text/html
  Content-length: 114
  Content-transfer-encoding: text
  Request-number: 1
  Document-type: Request
  Interface-Version: Test 1.4
  Connection: close
  
  ?xml version=1.0 encoding=UTF-8?DatavendorCompanyID/Data
  
  
  Larry
  
  On Sat, 2008-03-01 at 18:08 -0500, Nathan Nobbe wrote:
  
   hmm,  it looks to me like you want to post a bunch of raw data to the
   server.  im not sure exactly how to do that w/ the php curl functions...
   everything ive seen uses CURLOPT_POSTFIELDS to supply an associative
  array
   of data to be posted.  in this case you could easily send you data across
  by
   choosing a name for the index, something like 'postdata', anything will
  do,
   then it will be accessible on the system youre posting to via
   $_POST['postdata'].
  
   also, inlooking at your usage of CURLOPT_CUSTOMREQUEST, i dont believe
  youre
   using it correctly,  i think youre just supposed to put a string
   representing the desired http method in there, so something like 'HEAD',
   'PUT', or in this case 'POST'.  then you would supply the data as i said
   earlier, using CURLOPT_POSTFIELDS.  so in all, i think something like
  this
   would work for you,
  
  
  
  
   and also, in reading the warning about CURLOPT_CUSTOMREQUEST, you might
  just
   go with CURLOPT_POST = true, since you arent using an obscure http
  method.
   im not sure exactly how to determine if the server supports this method
  or
   not.  anyway, i found this in 'man curl_easy_setopt'  (thats the manpage
  for
   the c function php uses for the CURLOPT_CUSTOMREQUEST option).
  
 Many people have wrongly used this option to replace the
   entire request with their own, including multiple headers and POST
  contents.
   While that  might
 work  in  many  cases,  it will cause libcurl to send
  invalid
   requests and it could possibly confuse the remote server badly. Use
   CURLOPT_POST and CUR-
 LOPT_POSTFIELDS to set POST data. Use CURLOPT_HTTPHEADER to
   replace or extend the set of headers sent by libcurl. Use
   CURLOPT_HTTP_VERSION  to  change
 HTTP version.
  
   -nathan
  --
  Larry Brown [EMAIL PROTECTED]
  
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
-- 
Larry Brown [EMAIL PROTECTED]

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

[PHP] Anyone jump from Studio 5.5.x - Zend Eclipse?

2008-03-01 Thread Steve Finkelstein
Hi all,

I've tried googling around to find some blogs with decent information
on whether Zend Eclipse is mature enough to make the jump over from
5.5.x just yet.

Admittedly, I've dropped Zend Studio as of late and been writing all
of my code in TextMate -- but at the end of the day when a project is
complex enough, Zend Studio is much more powerful than TextMate with
all of its features and remote debugging capabilities.

Anyhow, I'm curious if it's worth it to check out Zend Eclipse yet.
We're a team of about 5-6 developers and I've been getting asked by a
few colleagues if I've tried it out yet since I'm usually the one to
try out the newer technologies.

I'd love to hear some feedback.

Thanks!

/sf

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