php-general Digest 3 Jun 2006 14:23:06 -0000 Issue 4164

Topics (messages 237310 through 237326):

Re: SPL Iterator and Associative Array
        237310 by: Greg Beaver
        237313 by: Jason Karns

Parse error: syntax error, unexpected '}'
        237311 by: Mark Sargent
        237312 by: Rick Emery
        237314 by: Bagus Nugroho
        237316 by: Mark Sargent

Re: php java intregration
        237315 by: Vedanta Barooah
        237319 by: Vedanta Barooah
        237324 by: Rabin Vincent

Recall: [PHP] Parse error: syntax error, unexpected '}'
        237317 by: Bagus Nugroho

HTTP HEADERS
        237318 by: kartikay malhotra
        237320 by: David Tulloh
        237321 by: Joe Wollard

Re: OO purism sucks - this is a rant for anyone who     is      allergic to 
that        kind of thing...
        237322 by: Jochem Maas

$B$"$d$G$9!#(B
        237323 by: ƒ‰ƒCƒgƒjƒ“ƒOƒvƒ‰ƒYƒ}

New release of phpEditIni Ver 1.0 Beta4 is now available
        237325 by: Jeremy O'Connor

Re: Retrieving Content
        237326 by: chris smith

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:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Jason Karns wrote:
> I'm going to try my best to explain what I'm trying to do.
> 
> I have my own class that has an array member.  This class itself implements
> Iterator.  One of the fields in the array is itself an array that I would
> like to iterate over. Here's some code:
> 
> class Folio implements Iterator {
> $projects = array(
>       array(
>               'title'=>"",
>               'clip'=>"",
>               'small'=>array('1','2','3')),
>       array(
>               'title'=>"",
>               'clip'=>"",
>               'small'=>array('0','1','2'))
> );
> function title($x){
>       return current($this->projects[$]['small']);
                                      ^^
> }
> 
> function smalls($x){
>       return $this->projects[$x]['small'];
> }
> }

<snip>
Hi Jason,

The code you pasted is littered with fatal errors and bugs (I marked one
example with "^^" above).  Please paste a real batch of code that you've
tested and reproduces the error and that will be much more helpful.  The
PHP version would be helpful to know as well.

Greg

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Greg Beaver [mailto:[EMAIL PROTECTED] 
> Sent: Friday, June 02, 2006 10:39 PM
> To: Jason Karns
> Cc: php-general@lists.php.net
> Subject: Re: SPL Iterator and Associative Array
> 
> Jason Karns wrote:
> > I'm going to try my best to explain what I'm trying to do.
> > 
> > I have my own class that has an array member.  This class itself 
> > implements Iterator.  One of the fields in the array is itself an 
> > array that I would like to iterate over. Here's some code:
> > 
<snip>
> 
> <snip>
> Hi Jason,
> 
> The code you pasted is littered with fatal errors and bugs (I 
> marked one example with "^^" above).  Please paste a real 
> batch of code that you've tested and reproduces the error and 
> that will be much more helpful.  The PHP version would be 
> helpful to know as well.
> 
> Greg
> 
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.394 / Virus Database: 268.8.1/354 - Release 
> Date: 6/1/2006
>  
> 

<?php
class Folio implements Iterator {
        private $projects = array();
        private $valid = FALSE;
        public function __construct($file = null) {
                if(!is_null($file))
                        $this->load($file);
        }
        public function load($file){
                ...
                $keys = array();
                $values = array();
                foreach ($projects as $project) {
                        $small = array();
                        $big = array();
                        foreach
($xpath->query('showcase/images/screenshot/thumbnail',$project) as $img){
                                $small[] = $img->nodeValue;}
                        foreach
($xpath->query('showcase/images/screenshot/src',$project) as $img){
                                $big[] = $img->nodeValue;}
                                
                        $keys[] =
$xpath->query('@id',$project)->item(0)->nodeValue;
                        $values[] = array(
        
'title'=>$xpath->query('showcase/title',$project)->item(0)->nodeValue,
        
'href'=>$xpath->query('livesite',$project)->item(0)->nodeValue,
        
'clip'=>$xpath->query('showcase/images/feature/thumbnail',$project)->item(0)
->nodeValue,
                                'big'=>$big,
                                'small'=>$small,
        
'text'=>$xpath->query('showcase/description',$project)->item(0)->nodeValue);
                }
                $this->projects = array_combine($keys,$values);
        }
        
        function &smalls($x=null){
                if(is_null($x) or !key_exists($x,$this->projects)) $x =
$this->key();
                return $this->projects[$x]['small'];
        }
        
        function small_src($x=null){
                if(is_null($x) or !key_exists($x,$this->projects)) $x =
$this->key();
                return current($this->projects[$x]['small']);
        }

        function small($x=null){
                if(is_null($x) or !key_exists($x,$this->projects)) $x =
$this->key();
                return '<a href="'.$this->small_href().'"
title="'.$this->small_title().'">'.$this->small_img($x).'</a>';
        }

}
?>

<?php
        reset($folio->smalls());
        while($s = current($folio->smalls())){
                echo $folio->small();
                next($folio->smalls());
        }
        
        foreach($folio->smalls() as $s){
                echo $folio->small();
        }
?>

Production server will be PHP 5.1.2, developing on 5.0.5
I am also considering making my own 'project' object and having Folio have
an array of 'projects' rather than using the array of associative arrays.
Would this provide a solution?

Thanks,
Jason

Attachment: smime.p7s
Description: S/MIME cryptographic signature


--- End Message ---
--- Begin Message ---
Hi All,

can anone see what's wrong with the below code? I get this error,


*Parse error*: syntax error, unexpected '}' in */usr/local/apache2/htdocs/moviedata2.php* on line *18

*
$age=1;
while($age<=100) {
$insert = "INSERT INTO age (age_label) VALUES ($age)";
$results = mysql_query($insert) or die(mysql_error());
$age++
}



Cheers.

Mark Sargent.

--- End Message ---
--- Begin Message ---
Quoting Mark Sargent <[EMAIL PROTECTED]>:

Hi All,

can anone see what's wrong with the below code? I get this error,


*Parse error*: syntax error, unexpected '}' in
*/usr/local/apache2/htdocs/moviedata2.php* on line *18

*
$age=1;
while($age<=100) {
$insert = "INSERT INTO age (age_label) VALUES ($age)";
$results = mysql_query($insert) or die(mysql_error());
$age++
}


There's a semi-colon missing at the end of the last line ($age++).

Hope thi shelps,
Rick
--
Rick Emery

"When once you have tasted flight, you will forever walk the Earth
 with your eyes turned skyward, for there you have been, and there
 you will always long to return"
                                              -- Leonardo Da Vinci

--- End Message ---
--- Begin Message ---
how about like this
---
$insert = "INSERT INTO age (age_label) VALUES ('$age')";
---

 
________________________________

From: Mark Sargent [mailto:[EMAIL PROTECTED]
Sent: Sat 03-Jun-2006 10:02
To: PHP List
Subject: [PHP] Parse error: syntax error, unexpected '}'



Hi All,

can anone see what's wrong with the below code? I get this error,


*Parse error*: syntax error, unexpected '}' in
*/usr/local/apache2/htdocs/moviedata2.php* on line *18

*
$age=1;
while($age<=100) {
$insert = "INSERT INTO age (age_label) VALUES ($age)";
$results = mysql_query($insert) or die(mysql_error());
$age++
}



Cheers.

Mark Sargent.

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





--- End Message ---
--- Begin Message ---
Hi All,

sorry, found it. Forgot the ; after $age++. Cheers.

Mark Sargent.

--- End Message ---
--- Begin Message ---
if i am not wrong the bridge is better if you are trying to put in php
into a java app server. i do know to create the jar in linux.... i
will try some other combinations and keep things posted.
i am not able to find the jar, anywhere yet though :(
- vedanta

On 6/3/06, Jon Anderson <[EMAIL PROTECTED]> wrote:
You could try something like PHP-Java bridge:
http://php-java-bridge.sourceforge.net/

I've set it up for our server farm at work, but never used it myself.
The developer who requested it seems quite fond of the extension, and
performance seems to be excellent.

jon

Vedanta Barooah wrote:
> really no one?
>
> On 6/2/06, Vedanta Barooah <[EMAIL PROTECTED]> wrote:
>> hello all,
>> i am setting up php_java.dll extension under windows/iis, my php
>> version is 5.1.2. can any one point me to the download location of
>> php_java.jar which is needed for the setup.
>>
>> i searched all the sites/mirrors but its not available. do i have to
>> compile from source to get that jar? ... let me know,... thanks
>>
>> - regards, vedanta
>>
>
>




--
*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*
Vedanta Barooah

--- End Message ---
--- Begin Message ---
So i tried to install the java support using the info available at
php.net/java but things here are still upset:

here is my configure:

'./configure' '--with-apxs2=/home/vedanta/srv/httpd2/bin/apxs'
'--with-config-file-path=/home/vedanta/srv/php5'
'--prefix=/home/vedanta/srv/php5' '--with-java=/opt/sun-jdk-1.4.2.10'
'--enable-java'

the build and install is a success, there is nothing created, which is
related to java, not even a directory named ext/java in the source
tree exists. the pecl.php.net site has no package named java...
finally i search the php-src cvs tree and .... whoa! - the
php-src/ext/java/ java tree is empty - are the extns removed?? -
http://cvs.php.net/viewcvs.cgi/php-src/ext/java/

after giving up the build yesterday on windows, i am not giving up
today on linux.
i am still kinda lost - and its getting frustrating.

thanks,
vedanta

PHP - 5.1.4
ABI : Gentoo 2006.0




On 6/3/06, Vedanta Barooah <[EMAIL PROTECTED]> wrote:
if i am not wrong the bridge is better if you are trying to put in php
into a java app server. i do know to create the jar in linux.... i
will try some other combinations and keep things posted.
i am not able to find the jar, anywhere yet though :(
- vedanta

On 6/3/06, Jon Anderson <[EMAIL PROTECTED]> wrote:
> You could try something like PHP-Java bridge:
> http://php-java-bridge.sourceforge.net/
>
> I've set it up for our server farm at work, but never used it myself.
> The developer who requested it seems quite fond of the extension, and
> performance seems to be excellent.
>
> jon
>
> Vedanta Barooah wrote:
> > really no one?
> >
> > On 6/2/06, Vedanta Barooah <[EMAIL PROTECTED]> wrote:
> >> hello all,
> >> i am setting up php_java.dll extension under windows/iis, my php
> >> version is 5.1.2. can any one point me to the download location of
> >> php_java.jar which is needed for the setup.
> >>
> >> i searched all the sites/mirrors but its not available. do i have to
> >> compile from source to get that jar? ... let me know,... thanks
> >>
> >> - regards, vedanta
> >>
> >
> >
>
>


--
*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*
Vedanta Barooah



--
*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*
Vedanta Barooah

--- End Message ---
--- Begin Message ---
On 6/2/06, Vedanta Barooah <[EMAIL PROTECTED]> wrote:
i am setting up php_java.dll extension under windows/iis, my php
version is 5.1.2. can any one point me to the download location of
php_java.jar which is needed for the setup.

Download "Collection of PECL modules for PHP" from the
Windows binaries section of php.net/downloads.php.

This is mentioned in php.net/java.

Rabin

--- End Message ---
--- Begin Message ---
Bagus Nugroho would like to recall the message, "[PHP] Parse error: syntax 
error, unexpected '}'".

--- End Message ---
--- Begin Message ---
Hi all!

I use HTTP POST to upload a file. I've a PHP script running on the server.
Are HTTP headers passed with this request? How can I see the headers passed
to the server?

Thanks
KM

--- End Message ---
--- Begin Message ---
kartikay malhotra wrote:
> Hi all!
> 
> I use HTTP POST to upload a file. I've a PHP script running on the server.
> Are HTTP headers passed with this request? How can I see the headers passed
> to the server?

Headers are passed by the client and server with every request.  The
Firefox Tamper Data extension shows the headers being sent and allows
you to modify them on the fly.


David

--- End Message ---
--- Begin Message ---
(sorry for the dup kartikay, forgot to hit reply to all;-)
So is the file going from server to server or from a client machine to the
server? It sounds like server to server - which if that's the case you can
use headers_list() to see what your server is going to be sending out to the
other server ( http://www.php.net/manual/en/function.headers-list.php) -
otherwise you can use the get_headers() function
(http://www.php.net/manual/en/function.get-headers.php)
see what headers the client sent you along with the file.

-Joe


On 6/3/06, kartikay malhotra <[EMAIL PROTECTED]> wrote:

Hi all!

I use HTTP POST to upload a file. I've a PHP script running on the server.
Are HTTP headers passed with this request? How can I see the headers
passed
to the server?

Thanks
KM



--- End Message ---
--- Begin Message ---
Rasmus Lerdorf wrote:
Jochem Maas wrote:

I understand the point you made below - you have made this argument before
and I, for one, accepted it as valid when I first read the discussion
on internals - which is why I avoided ranting about that (and changes like it)


But you didn't avoid it, you used it as an example to back up your rant.

that wasn't me that was Robert in a reply to my rant.


And on the OO side your argument gets shaky as well. The whole point of OO is to add a very structured layer on top of your code to make it more consistent and more maintainable than the equivalent procedural code. There is nothing you can do in OO that you can't do with completely freeform procedural code. When you choose to go OO, you choose a set of rules and a certain code structure that by definition is going to be somewhat constrained. The argument over exactly how constrained this should be and where we should loosen things up will continue until the end of time. PPP and Interfaces are all about constraints. They serve no practical purpose whatsoever other than to add constraints.

the point I *tried* to make (granted maybe not very well) was that the engine
constraints & behaviour themselves are not particularly consistent *and* they
change too often and in too arbitrary a fashion.

...

--- End Message ---
--- Begin Message ---
あやっていいます。暇なら会ってエッチしませんか?急にビックリですよね。
どうしてもエッチがしたしたくて、私は今からでも平気です。
写真こっち http://sruq.com/?a02  で確認してOKだったら、携帯のアドレスも載ってるから、そっちにメールしてほしいです。




メルいらない?
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
New release of phpEditIni Ver 1.0 Beta4 is now available at 
http://phpeditini.net .. Now handles Windows and Linux/*nix line ends 
correctly.

Use phpEditIni to edit your PHP.INI files in a browser.

--
[EMAIL PROTECTED] 

--- End Message ---
--- Begin Message ---
On 6/3/06, Adam Zey <[EMAIL PROTECTED]> wrote:
Rodrigo de Oliveira Costa wrote:
> I just discovered the problem I have to retrieve the output of the
> site and not the url since its dynamic. Ca I do it like retrieve the
> output of this url:
>
> www.tryout.com/1/2/
>
> And of course store it on a variable? How to do it? I founr the func
> below but couldnt understand how to make it work with a url.
>
> Thanks guys,
> Rodrigo
>
>
> ob_start();
> include('file.php');  //  Could be a site here? What should I do to
> retrieve it from an url?
> $output = ob_get_contents();
> ob_end_clean();
Umm..... As I said, just use file_get_contents():

$file = file_get_contents("http://www.tryout.com/1/2/";);

Assuming allow_url_fopen is on.

If not, you could try using curl - see http://www.php.net/curl

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---

Reply via email to