php-general Digest 2 May 2004 22:54:17 -0000 Issue 2740

Topics (messages 185136 through 185158):

Re: Progress Bar
        185136 by: Burhan Khalid

http username
        185137 by: Harry.de
        185138 by: Matt
        185139 by: rich

Re: String Question
        185140 by: John W. Holmes

Setting fopen timeout ?
        185141 by: Dave Carrera
        185158 by: Marek Kilimajer

Re: Results in array
        185142 by: Burhan Khalid

Re: PHP Auth
        185143 by: Burhan Khalid

Help with Curl GZIP problem?
        185144 by: Dac Chartrand
        185149 by: Dac Chartrand

Re: Frage
        185145 by: Torsten Roehr

Is Curl GZIP support broken?
        185146 by: Dac Chartrand
        185147 by: Curt Zirzow
        185148 by: Dac Chartrand
        185150 by: Dac Chartrand
        185153 by: Curt Zirzow
        185157 by: Dac Chartrand

looking for PHP/MYSQL developer in SW london,UK
        185151 by: scott.broadcastwarehouse.com

Trouble setting include_path
        185152 by: Pablo Gosse
        185154 by: Curt Zirzow

Re: Numeric Index of an array
        185155 by: Marek Kilimajer

Array Question
        185156 by: Jason Williard

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 --- Craig Gardner wrote:

I'm working on a script that will automatically download and burn an ISO to a CD, when passed the filename of the ISO and I want to use some sort of progress bar to show how much of the download/burn is complete. I was originally going to use wget to download the file, but I don't know how to get the progress of the download. Before the script processes, I have the filename and filesize. Does anyone know of a way to get the file to download and give me the percentage of the file downloaded or even the filesize of the local copy every couple seconds or so?

http://pear.php.net/package/HTML_Progress

--- End Message ---
--- Begin Message ---
If a user is logged in via http (authentification e.g. with  .htaccess and
.htpasswd file), how can i get the username of the current logged in user?

Thanx
Harry

--- End Message ---
--- Begin Message ---
> If a user is logged in via http (authentification e.g. with  .htaccess and
> .htpasswd file), how can i get the username of the current logged in user?

Read the manual at: http://www.php.net/manual/en/features.http-auth.php

--- End Message ---
--- Begin Message ---
> If a user is logged in via http (authentification e.g. with  .htaccess and
> .htpasswd file), how can i get the username of the current logged in user?
>
> Thanx
> Harry

try $_SERVER['PHP_AUTH_USER']

rich

--- End Message ---
--- Begin Message --- Dave Carrera wrote:
How would I show 100 chars after finding the first instance of a searched
word in a string.

$start = strpos('hello',$str); $hundredchars = substr($str,$start,100);

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
Hi List,

How can I set fopen to time out if a url is not reachable ?

I have tried set_time_limit but that dose not seem to work.

Thank you in advance for any help or pointers.

Dave C

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.674 / Virus Database: 436 - Release Date: 02/05/2004
 

--- End Message ---
--- Begin Message --- Dave Carrera wrote:
Hi List,

How can I set fopen to time out if a url is not reachable ?

I have tried set_time_limit but that dose not seem to work.

Thank you in advance for any help or pointers.

Dave C


I'm not sure it will help but try ini_set('default_socket_timeout', XX);


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.674 / Virus Database: 436 - Release Date: 02/05/2004



--- End Message ---
--- Begin Message --- Phpu wrote:

I want to interogate the database and the results to be placed into array.

For now i have:

$query = "SELECT product_id, brand_name, model_name FROM products WHERE 
product_id='$product_id'";
$result = mysql_query($query) or die("error in query - $query - ".mysql_error());
 $results = mysql_num_rows($result);


I want all athe results to be placed in an array named "models" and then i want to print all the results. How can i do that.
PS. The results must be placed in an array.

while($row = mysql_fetch_assoc($results)) { $models[] = $row; } echo "<pre>"; print_r($models); echo "</pre>";

--- End Message ---
--- Begin Message --- Anton Krall wrote:

Guys.
Im doing a small php auth system and I was wondering, how can avoid having
to do a form to pass the user and pw to the php scripts and just use the
popup auth windows on IE and NS? do you remember the names of the vars that
get passed thru that popup or how can I invoke it?

http://www.zend.com/zend/tut/authentication.php


(please don't ask for read reciepts in your emails to the list)
--- End Message ---
--- Begin Message --- The following code used to work until i upgraded to 4.3.6

Code:
---------------
// Get RSS feed
$c =
curl_init('http://www.vegguide.org/rss/feed.rss?all=1&omit_hours=1');
curl_setopt($c, CURLOPT_ENCODING, 'gzip');
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_COOKIEFILE, $cookie_jar);
// *** This next line is the problem! ***
$data = curl_exec($c);
curl_close($c);


Expected result: ---------------- $data should be text. xml_parse($xml, $data) should be able to handle it.

Actual result:
--------------
$data is compressed gzip binaray data. I can't use it in this format.

What changed?
--- End Message ---
--- Begin Message --- Sorry, this is a dupe.

See: "Is Curl GZIP support broken?" in this same newsgroup.

Thank you.
--- End Message ---
--- Begin Message ---
"Draw-A-Line" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hallo,
> ich hoffe mir kann jemand bei folgendem Problem helfen. Habe ein Formular
> erstellt und darin ist ein "file field" eingebettet zum Hochladen von
> Dateien (z.B. Word-Dokumente). Habe den Zusatz
enctype="multipart/form-data
> " in das form tag eingefügt und an ein php-Script zur Auswertung
geschickt.
> Im php-Script habe ich die hochgeladene Datei aus dem temp-Verzeichnis des
> Server auf ein Verzeichnis innerhalb meiner Web site  mit em Befehl
> move_uploaded_file (move_uploaded_file($_FILES['Dokument']['tmp_name'],
> $uploaddir . $_FILES['Dokument']['name']) umgeleitet. Wie kann ich die
> hochgeladene Datei direkt vom Formular aus als Attachment an meine Email
> senden - wie es mit den restlichen Daten des Formulars passiert? Geht das
> auch über die mail() Funktion?

Hi Klaus,

you could use the PEAR class Mail_Mime to send a mail with an attachment:
http://pear.php.net/manual/en/package.mail.mail-mime.php

Just add $_FILES['Dokument']['tmp_name'] as an attachment and it should
work.

Regards, Torsten

> Klaus
>
> Klaus Steinkuhl
> www.Draw-a-Line.com
> Web and Graphic Design

--- End Message ---
--- Begin Message --- The following code used to work until i upgraded to 4.3.6

Code:
---------------
// Get RSS feed
$c =
curl_init('http://www.vegguide.org/rss/feed.rss?all=1&omit_hours=1');
curl_setopt($c, CURLOPT_ENCODING, 'gzip');
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_COOKIEFILE, $cookie_jar);
// *** This next line is the problem! ***
$data = curl_exec($c);
curl_close($c);


Expected result: ---------------- $data should be text. xml_parse($xml, $data) should be able to handle it.

Actual result:
--------------
$data is compressed gzip binaray data. I can't use it in this format.

What changed?
--- End Message ---
--- Begin Message ---
* Thus wrote Dac Chartrand ([EMAIL PROTECTED]):
> The following code used to work until i upgraded to 4.3.6
> 
> Code:
> ---------------
> // Get RSS feed
> $c =
> curl_init('http://www.vegguide.org/rss/feed.rss?all=1&omit_hours=1');
> curl_setopt($c, CURLOPT_ENCODING, 'gzip');
> curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
> curl_setopt($c, CURLOPT_COOKIEFILE, $cookie_jar);
> // *** This next line is the problem! ***
> $data = curl_exec($c);
> curl_close($c);

Check curl_errno() and curl_error().

it sounds like there is a problem with your libcurl


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

--- End Message ---
--- Begin Message ---
Check curl_errno() and curl_error().

it sounds like there is a problem with your libcurl


I'm not getting any errors using the above functions.


Sample PHP code is available at:

http://www.vegguide.org/plain/rss-code/get_and_parse_vegguide_rss_feed-php

(Requires an account to be able to download RSS data) It used to work, now it doesn't. The problem is the follwing line:

$data = curl_exec($c);

$data used to be a string. Now it's GZIP compressed binary data that i can't work with.

The only thing that has changed is me upgrading to PHP 4.3.6

Any other ideas?
--- End Message ---
--- Begin Message --- PS: I'm using w2k with apache.

http://www.php.net/get/php-4.3.6-Win32.zip/from/a/mirror


Check curl_errno() and curl_error().


it sounds like there is a problem with your libcurl


Curt

--- End Message ---
--- Begin Message ---
* Thus wrote Dac Chartrand ([EMAIL PROTECTED]):
> >Check curl_errno() and curl_error().
> >
> >it sounds like there is a problem with your libcurl
> >
> 
> I'm not getting any errors using the above functions.
> 
> Sample PHP code is available at:
> 
> http://www.vegguide.org/plain/rss-code/get_and_parse_vegguide_rss_feed-php
> 
> (Requires an account to be able to download RSS data) It used to work, 
> now it doesn't. The problem is the follwing line:
> 
> $data = curl_exec($c);
> 
> $data used to be a string. Now it's GZIP compressed binary data that i 
> can't work with.

php simply calls the libcurl function and returns what libcurl came
back with.  There might be problem with the curl.dll your using.

You might want to try setting CURLOPT_ENCODING to 'defalate'.
otherwise dont set any compression requests.

I've tested  your code with php5 and libcurl 7.10 and gzip
compression works fine.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

--- End Message ---
--- Begin Message ---
php simply calls the libcurl function and returns what libcurl came
back with.  There might be problem with the curl.dll your using.

The curl.dll i am using is packaged with the binary distribution of PHP (i'm on windows), so if there is a problem with it, there's a problem with the PHP distro.


I filed a bug indicating this, but was marked as bogus.

http://bugs.php.net/bug.php?id=28168

You might want to try setting CURLOPT_ENCODING to 'defalate'.
otherwise dont set any compression requests.

This seems to work (slowly?) under test conditions. I'll keep you posted if it works when the 'cron' job is executed several hours from now.


Thank you for your help.
--- End Message ---
--- Begin Message ---
Hello gang
My company is looking for someone who can work freelance/part-time on some
web projects we have.
The right person must have experience in PHP/MYSQL in an e-commerce
capacity. Graphics skills  (Photoshop etc) are also required. C++/MFC
experience would be handy but not essential.
We would ideally like someone who is able to spend some time working at our
HQ in Wimbledon, SW London.
Please reply via email if you are able to help or can point us in the
direction of finding someone who can?
Best regards
Scott

--- End Message ---
--- Begin Message ---
Hi folks.  I'm trying to use an .htaccess file to set my include path
and for some reason it's not overriding the value in php.ini, but
instead still shows and uses the original value from php.ini, not what
is in the .htaccess file.

I know that include_path is one of the values that can be set anywhere,
so I'm confused as to why this is happening.

I've placed the following .htaccess file in www.mysite.ca/test/: 

php_value include_path /home/pablo/foo

And in www.mysite.ca/test/test.php I have one line:

include_once 'foo.php';

which refers to the file /home/pablo/foo/foo.php

However when I run test.php it does not include foo.php and the error
message informs me that the include_path value being used is still the
one from the php.ini file.

Has anyone run into this before or got any idea why this is happening?

Cheers and TIA.

Pablo

--- End Message ---
--- Begin Message ---
* Thus wrote Pablo Gosse ([EMAIL PROTECTED]):
> Hi folks.  I'm trying to use an .htaccess file to set my include path
> and for some reason it's not overriding the value in php.ini, but
> instead still shows and uses the original value from php.ini, not what
> is in the .htaccess file.

Most default apache configurations now a days dont have .htaccess
enabled by default (for performance reasons.) Or some hosting
services implicitly turn this option off. So no matter what
you put in the .htaccess file, it will be ignored.

You can test this by putting in your .htaccess file something like:
bogus_statment

if you reload your page on your server and dont get a "500 server
error", apache isn't even looking at the .htaccess file. You can
set set the include_path using the php function ini_set().


Another possibility is that  the hosting company had issued an
apache command:
  php_admin_value include_path /path/for/include

Then you can't modify the include_path at all.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

--- End Message ---
--- Begin Message --- Natascha Chrobok wrote:
How can I get the numeric Index of an array when the index is a string?


string indexes don't have numeric indexes. they are in order however, if you want to find the order of a value, use:


echo array_search(array_search("my second value", $myArray), array_keys($myArray));
--- End Message ---
--- Begin Message ---
I am using the following array and function in the template for my website.
It works great, but I want to to be better.  I would to make it so the last
item displayed looks differently than the others, but I have been unable to
figure out how to distinguish the last item.

When displayed, the crumbs look like:

SITENAME » RANDOM » ITEM

I would like ITEM to look differently.  Can anyone tell me how to modify the
select ITEM?

// CRUMBS ARRAY
$crumbs = array(
  array( "RANDOM", "RANDOM_URL" ),
  array( "ITEM", "ITEM_URL" )
  );

// CRUMBS FUNCTION
function breadCrumbs($crumbs) {

 if ( count($crumbs) > 0 ) {
  $spacer       = " <span
style=\"color:#94cf42;font-size:15px;font-weight:bold;\">&raquo;</span> ";
  $breadCrumbs  = "<a href=\"URL/\">SITE_NAME</a>\n";

   foreach( $crumbs as $crumb ) {
   if ( count($crumb) == "2" ) {
    $breadCrumbs .=  "$spacer<a href=\"$crumb[1]\">$crumb[0]</a>\n";
   }

  }

 echo "<!-- ####################### BREADCRUMBS STARTS HERE
####################### -->\n";
 echo "<span class=\"breadcrumbs\">\n";
 echo $breadCrumbs;
 echo "</span>\n";
 echo "<!-- ######################## BREADCRUMBS ENDS HERE
######################## -->\n";
 }
}

--- End Message ---

Reply via email to