php-general Digest 10 Jan 2008 15:22:57 -0000 Issue 5227
Topics (messages 266992 through 267023):
Re: Unable to override status code in certain installations..?
266992 by: Richard Lynch
Re: Get Parameters in Includes?
266993 by: mike
266997 by: Liam
266999 by: Chris
267001 by: mike
267002 by: Richard Lynch
267003 by: Liam
267006 by: mike
Inclusion with Get Parameters?
266994 by: Liam
266998 by: Jim Lucas
267000 by: Liam
Re: fgetcsv
266995 by: Richard Lynch
266996 by: Richard Lynch
267005 by: Danny Brow
267008 by: Danny Brow
Re: PHP SOAP Client formats
267004 by: Tim Traver
267010 by: Nathan Nobbe
267015 by: Tim Traver
Scratch that
267007 by: Liam
267009 by: Liam
267011 by: mike
267013 by: Liam
267014 by: mike
267016 by: Liam
267017 by: mike
Rephrase
267012 by: Liam
Get Parameters in Includes [SOLVED!!!]
267018 by: Liam
267019 by: mike
267020 by: Liam
267023 by: Daniel Brown
Closures in PHP
267021 by: John Papas
267022 by: Jochem Maas
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 ---
On Wed, January 9, 2008 4:35 pm, RavenWorks wrote:
> I'm currently trying to create a system where a custom 404
> ErrorDocument in
> PHP is able to 301 Redirect the browser in certain cases. This works
> fine on
> some servers, however, on some other servers the PHP script seems to
> be
> unable to replace the 404 header.
>
> Correctly overrides with '200' status:
> http://fidelfilms.ca/redirectTest/
>
> Unable to override default '404' status:
> http://fraticelli.info/redirectTest/
>
> Those two pages will look the same in a browser window, but one
> returns 404
> and one returns 200 (as it should, because of the header() call) --
> check
> with whatever browser plugin you prefer for reading HTTP headers, such
> as
> Live HTTP Headers for Firefox.
>
> Returning the correct status code is important because we're migrating
> a
> site from one domain to another, and we don't want to lose ranking in
> search
> engines. (In the examples above, I return 200 as a test, but in
> practice
> this will be used to 301 all visitors -- and search engines -- to the
> new
> domain.)
>
> My question is this: What causes PHP to be able to override the
> ErrorDocument status on some servers and not others? Is it caused by
> PHP's
> behavior or Apache? Is this a configurable option, or was the behavior
> permanently changed in a given version of either?
I think you are falling prey to a PHP bug.
You should be able to find it in:
http://bugs.php.net
You could also check the ChangeLogs:
http://php.net/ChangeLog-5.php
http://php.net/ChangeLog-4.php
I could be wrong, as my memory is rather vague on this one, and it's
always possible that you have similar/same symptoms with an entirely
different issue.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
that is a horrible method.
it works in zeus and apache, but not lighttpd, from my experience.
it's just not a good idea. technically that should only be file paths,
and i would expect it to load a file named "x.cgi?want=ssilinks"
although fopen wrappers can confuse that further...
in my opinion i would say "redesign it properly."
On 1/9/08, Liam <[EMAIL PROTECTED]> wrote:
> How do I use a get parameter in a include?
>
> e.g.
> <?php include('x.cgi?want=ssilinks') ?>
>
> I can't modify the cgi file though, and HTML includes don't work on my
> server.
>
> Thanks in advance.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
mike wrote:
that is a horrible method.
Thanks for the nice positive, refreshing and most helpful response.
in my opinion i would say "redesign it properly."
Well what the hell do you suggest I do??? The script is MEANT to be
used this way, as it has an admin panel inside etc.
Oh, by the way, nice grammar.
--- End Message ---
--- Begin Message ---
The script is MEANT to be used this way
I doubt it.
If you want the contents from that url, then use curl
(http://www.php.net/curl).
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
On 1/9/08, Liam <[EMAIL PROTECTED]> wrote:
> mike wrote:
> > that is a horrible method.
> Thanks for the nice positive, refreshing and most helpful response.
read the sentence below it.
> > in my opinion i would say "redesign it properly."
> Well what the hell do you suggest I do??? The script is MEANT to be
> used this way, as it has an admin panel inside etc.
provide more details. like what is the .cgi? perl? or is it PHP as
well for some reason?
> Oh, by the way, nice grammar.
i gave you an opinion and my personal experience trying to support the
same method you're attempting here. i did not only reply to say "don't
do it"
i assume the .cgi is in perl, and you're trying to call this in PHP?
if it is all PHP, you can define a variable and just call the include
without having to deal with a query string. probably not the case.
if not, then pre-generate the navigation items in a flatfile and call
that in using include(). otherwise you can waste a web request each
time back to your webserver to execute the CGI with the proper
environment and parameters.
i could give a rip about capitalization here, and the grammar being
used is good enough to be understood. either way, you'll skip past the
meat of the message anyway and look for other things to reply about.
--- End Message ---
--- Begin Message ---
On Wed, January 9, 2008 8:38 pm, Liam wrote:
> How do I use a get parameter in a include?
>
> e.g.
> <?php include('x.cgi?want=ssilinks') ?>
>
> I can't modify the cgi file though, and HTML includes don't work on my
> server.
>
> Thanks in advance.
In order to fire the CGI and have it processed, you would need to do:
$html = file_get_contents("http://.../x.cgi?want=ssilinks");
This will require php.ini to have allow_url_fopen set to "on" which
has some serious security considerations to ponder before you go
changing it...
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On 1/9/08, Liam <[EMAIL PROTECTED]> wrote:
mike wrote:
that is a horrible method.
Thanks for the nice positive, refreshing and most helpful response.
read the sentence below it.
in my opinion i would say "redesign it properly."
Well what the hell do you suggest I do??? The script is MEANT to be
used this way, as it has an admin panel inside etc.
provide more details. like what is the .cgi? perl? or is it PHP as
well for some reason?
Oh, by the way, nice grammar.
i gave you an opinion and my personal experience trying to support the
same method you're attempting here. i did not only reply to say "don't
do it"
i assume the .cgi is in perl, and you're trying to call this in PHP?
if it is all PHP, you can define a variable and just call the include
without having to deal with a query string. probably not the case.
if not, then pre-generate the navigation items in a flatfile and call
that in using include(). otherwise you can waste a web request each
time back to your webserver to execute the CGI with the proper
environment and parameters.
i could give a rip about capitalization here, and the grammar being
used is good enough to be understood. either way, you'll skip past the
meat of the message anyway and look for other things to reply about.
The cgi script IS perl. Oh, RE: the sentence below it: I'm running
apache, and it DOESN'T work. The reason I am trying to call it in php
is to include it on a webpage. So, tell me, how am I supposed to
pre-generate the contents in a flatfile (whatever that is)? Or if I
can't do that, then what I am supposed to do?
--- End Message ---
--- Begin Message ---
On 1/9/08, Liam <[EMAIL PROTECTED]> wrote:
> The cgi script IS perl. Oh, RE: the sentence below it: I'm running
> apache, and it DOESN'T work. The reason I am trying to call it in php
> is to include it on a webpage. So, tell me, how am I supposed to
> pre-generate the contents in a flatfile (whatever that is)? Or if I
> can't do that, then what I am supposed to do?
1) lynx -dump http://blah.com/x.cgi?getssi >file.htm every so often,
or some other method to request the cgi and dump the output
2) include("http://blah.com/x.cgi?getssi") requires fopen wrappers on
includes and is a poor security measure (would not really recommend
this)
3) use curl functions to grab it in PHP and display (still will
technically issue an HTTP request) - probably the best method, if you
have to.
CGI scripts are not designed to be executed on the command line using
parameters like GET. which is why it's poorly supported. i do have it
working under zeus and i have had it working in the past under apache,
but it might have been due to a specific configuration method (it also
was not CGI, but an SSI call to a php script with GET parameters...
same idea, but different SAPI, which could be why it doesn't work for
you anyway)
--- End Message ---
--- Begin Message ---
Hi!
I have a cgi script that returns a particular value when I call it as
x.cgi?want=ssilinks. I need to call it like that, but whenever I put
the GET parameter into the include path, I get a warning saying that the
file could not be found. Any help?
Thanks,
Liam
--- End Message ---
--- Begin Message ---
Liam wrote:
Hi!
I have a cgi script that returns a particular value when I call it as
x.cgi?want=ssilinks. I need to call it like that, but whenever I put
the GET parameter into the include path, I get a warning saying that the
file could not be found. Any help?
Thanks,
Liam
I would look into calling it from exec() or system(). That might work
better.
Or, I would look into calling it with cURL. This way you call it like
you would in your browser. That will work the best.
Jim
--- End Message ---
--- Begin Message ---
Jim Lucas wrote:
Liam wrote:
Hi!
I have a cgi script that returns a particular value when I call it as
x.cgi?want=ssilinks. I need to call it like that, but whenever I put
the GET parameter into the include path, I get a warning saying that
the file could not be found. Any help?
Thanks,
Liam
I would look into calling it from exec() or system(). That might work
better.
Or, I would look into calling it with cURL. This way you call it like
you would in your browser. That will work the best.
Jim
Thanks for your reply, but I don't understand you. PHP is not my mother
tongue :P Could you please give me examples? It seems I forgot to
mention that that is an include.
--- End Message ---
--- Begin Message ---
On Wed, January 9, 2008 4:35 pm, Danny Brow wrote:
> I'm trying to compare a value to the first field in a csv fILE
> (example
> of the data below). Using while takes too long and I can't figure out
> how to compare just one row at a time. I've tried some variations of
> the
> following.
>
>
> //Common for all trials
> $demoID = fopen("newDemoID.csv", "r");;
> $ID = "43";
>
> $data = fgetcsv($demoID);
>
>
>
> First try with while:
>
> /*
> while ($data) {
> if ($data[0] == $wolfID) {
> print $data[1] . "," . $data[2] . "," . $data[3] .
> ".\n";
> }
> }
> */
>
>
> Takes for every.
*IF* the line you are looking for is almost always in the early rows,
and *IF* you only need the first match,
you can use the above and put a "break;" inside the if { }
This will let the script end as soon as it finds the answer.
You do have another $data = fgetcsv($demoID); inside the while loop,
right?
Otherwise you are looking at the same first line over and over and
over and over and over until PHP gives up on you.
> I can't use just the below because it only compares the first row.
>
> /*
> if ($data[0] == $wolfID) {
> print $data[1] . "," . $data[2] . "," . $data[3] . ".\n";
> }
>
> */
>
>
> I know this is simple, but I've hit codes block due to lack of sleep.
It's actually not simple at all, since you are trying to scan through
a large file (it must be large to take a long time) and find only one
chunk at the beginning of a row.
There are several other techniques to consider:
#1.
Put the data into an SQL database before you try to search for
specific field/value information.
SQL was designed to make this stuff fast.
CSV was designed to dump files out to pass between
spreadsheets/databases.
#2.
*IF* the file isn't TOO large compared to your available RAM, you
could load the whole thing with "file_get_contents" and then do some
preg magic to find the line you want:
$file = file_get_contents("/full/path/to/file");
preg_match("/^$wolfID,.*\$/ms", $file, $match);
var_dump($match);
//use preg_match_all to find ALL the lines that match
#3.
*IF* the file is too large, and *IF* the CSV parsing is the slow part
(which I doubt) it's possible that a simple fgets() and simple check
sch as:
if (substr($line, 0, strlen($wolfID)) == $wolfID)
would be faster...
Actually, pull the strlen($wolfID) out of the loop into a variable,
and maybe use strpos instead of substr instead and...
The biggest time sink is probably reading the file line by line,
though, not the actual processing which is pretty minimal... In which
case this solution will probably not significantly beat your current
time.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
6500 rows is chump-change.
You probably don't have the fgetcsv inside the while loop to get past
the first row... :-)
On Wed, January 9, 2008 6:09 pm, Danny Brow wrote:
> I need to compare the first field of each row. But this idea is shot
> to
> hell, i've been running one of the examples on the file and it's been
> about an hour+ already... 6500 records have to be checked... I think
> MySQL is calling my name right now.
>
> Thanks,
> Dan
>
>
> On Thu, 2008-01-10 at 09:59 +1100, Chris wrote:
>> Danny Brow wrote:
>> > Hi Everyone,
>> >
>> > I'm trying to compare a value to the first field in a csv fILE
>> (example
>> > of the data below). Using while takes too long and I can't figure
>> out
>> > how to compare just one row at a time. I've tried some variations
>> of the
>> > following.
>>
>> So are you trying to compare the first column or the first row?
>> You've
>> said you want to compare both.
>>
>> To compare the first row:
>>
>> <?php
>>
>> $handle = fopen('file.csv', 'r') or die("unable to open file");
>>
>> $my_row = array('1','2','John Smith');
>>
>> $data = fgetcsv($handle, 1000, ",");
>>
>> if ($data === false) {
>> echo "Unable to get anything from the file.";
>> }
>>
>> if (is_array($data)) {
>> if ($data == $my_row) {
>> echo "The first row matched\n";
>> } else {
>> echo "The first row didnt match\n";
>> }
>> }
>>
>> fclose($handle);
>>
>>
>> If you really do want to compare the first column, then the time to
>> do
>> it will be based on how big the csv file is. If you have a big file,
>> it's going to take a long time to go through each row and then look
>> at
>> the first field.
>>
>> <?php
>>
>> $handle = fopen('file.csv', 'r') or die("unable to open file");
>>
>> $my_value = '1';
>>
>> $row_count = 0;
>> while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
>> $row_count++;
>> if ($data[0] == $my_value) {
>> echo "Found my_value on row ", $row_count, "\n";
>> } else {
>> echo "Did not find my_value on row ", $row_count, "\n";
>> }
>> }
>>
>> fclose($handle);
>>
>> --
>> Postgresql & php tutorials
>> http://www.designmagick.com/
>>
>
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
Um, I've read the manual.
On Wed, 2008-01-09 at 20:11 -0500, Bastien Koert wrote:
> http://ca.php.net/manual/en/function.fgetcsv.php
> _________________________________________________________________
> Discover new ways to stay in touch with Windows Live! Visit the City @ Live
> today!
> http://getyourliveid.ca/?icid=LIVEIDENCA006
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
--- End Message ---
--- Begin Message ---
You are so right, takes all of 0.122 s to process the whole file with
the fgetcsv inside the while loop.... Guess I need to look up why this
was the problem.
Thanks everyone!
On Wed, 2008-01-09 at 20:59 -0600, Richard Lynch wrote:
> 6500 rows is chump-change.
>
> You probably don't have the fgetcsv inside the while loop to get past
> the first row... :-)
>
> On Wed, January 9, 2008 6:09 pm, Danny Brow wrote:
> > I need to compare the first field of each row. But this idea is shot
> > to
> > hell, i've been running one of the examples on the file and it's been
> > about an hour+ already... 6500 records have to be checked... I think
> > MySQL is calling my name right now.
> >
> > Thanks,
> > Dan
> >
> >
> > On Thu, 2008-01-10 at 09:59 +1100, Chris wrote:
> >> Danny Brow wrote:
> >> > Hi Everyone,
> >> >
> >> > I'm trying to compare a value to the first field in a csv fILE
> >> (example
> >> > of the data below). Using while takes too long and I can't figure
> >> out
> >> > how to compare just one row at a time. I've tried some variations
> >> of the
> >> > following.
> >>
> >> So are you trying to compare the first column or the first row?
> >> You've
> >> said you want to compare both.
> >>
> >> To compare the first row:
> >>
> >> <?php
> >>
> >> $handle = fopen('file.csv', 'r') or die("unable to open file");
> >>
> >> $my_row = array('1','2','John Smith');
> >>
> >> $data = fgetcsv($handle, 1000, ",");
> >>
> >> if ($data === false) {
> >> echo "Unable to get anything from the file.";
> >> }
> >>
> >> if (is_array($data)) {
> >> if ($data == $my_row) {
> >> echo "The first row matched\n";
> >> } else {
> >> echo "The first row didnt match\n";
> >> }
> >> }
> >>
> >> fclose($handle);
> >>
> >>
> >> If you really do want to compare the first column, then the time to
> >> do
> >> it will be based on how big the csv file is. If you have a big file,
> >> it's going to take a long time to go through each row and then look
> >> at
> >> the first field.
> >>
> >> <?php
> >>
> >> $handle = fopen('file.csv', 'r') or die("unable to open file");
> >>
> >> $my_value = '1';
> >>
> >> $row_count = 0;
> >> while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
> >> $row_count++;
> >> if ($data[0] == $my_value) {
> >> echo "Found my_value on row ", $row_count, "\n";
> >> } else {
> >> echo "Did not find my_value on row ", $row_count, "\n";
> >> }
> >> }
> >>
> >> fclose($handle);
> >>
> >> --
> >> Postgresql & php tutorials
> >> http://www.designmagick.com/
> >>
> >
> >
> > --
> > This message has been scanned for viruses and
> > dangerous content by MailScanner, and is
> > believed to be clean.
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some indie artist.
> http://cdbaby.com/from/lynch
> Yeah, I get a buck. So?
>
>
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
--- End Message ---
--- Begin Message ---
Bastien,
Thank you for answering, but the issue is that the PHP SOAPClient
classes actually create that xml to send, so I have no control over the
xml that is sent with a call command to the SOAP object...
I just wondered if there was any flags that I am missing that might
bring the php stuff in line with what the server expects.
I want to use PHP's built in classes for this so I don't have to
manually send xml to the api...
Thanks,
Tim.
Bastien Koert wrote:
XML is case sensitive. I notice the case of the xml is different. Try
making the PHP created xml the same case.
Bastien
> Date: Wed, 9 Jan 2008 13:54:36 -0800
> From: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Subject: [PHP] PHP SOAP Client formats
>
> Hi all,
>
> ok, I am a little bit new to the SOAP game, but I understand it, and am
> using it to talk to an outside API.
>
> The problem that I have is that the server that I am talking to
(that is
> not in my control), will accept the following SOAP call
>
> <?xml version="1.0" encoding="utf-8"?>
> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> <soap:Body>
> <AuthenticateTest xmlns="https://api.authorize.net/soap/v1/">
> <merchantAuthentication>
> <name>name</name>
> <transactionKey>string</transactionKey>
> </merchantAuthentication>
> </AuthenticateTest>
> </soap:Body>
> </soap:Envelope>
>
>
> But it refuses a call that I have made using the SOAPClient PHP classes
> that look like this :
>
> <?xml version="1.0" encoding="UTF-8"?>
> <SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="https://api.authorize.net/soap/v1/">
> <SOAP-ENV:Body>
> <ns1:AuthenticateTest>
> <merchantAuthentication>
> <name>name</name>
> <transactionKey>string</transactionKey>
> </merchantAuthentication>
> </ns1:AuthenticateTest>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
> It appears that the one that PHP creates is all in line with all of the
> latest standards, and I know that the server is a Microsoft IIS server.
>
> Does anyone know any parameters that I can use with the PHP SOAP client
> that could help me contruct the request like the top one???
>
> I don't want to have to build the text myself, and open a socket and
> send the text manually like I did to verify that the top one works, and
> the bottom one doesn't.
>
> Thanks,
>
> Tim.
>
------------------------------------------------------------------------
HO HO HO, if you've been nice this year, email Santa! Visit
asksanta.ca to learn more! <http://asksanta.ca/?icid=SANTAENCA005>
--- End Message ---
--- Begin Message ---
On Jan 9, 2008 10:45 PM, Tim Traver <[EMAIL PROTECTED]> wrote:
> Bastien,
> I want to use PHP's built in classes for this so I don't have to
> manually send xml to the api...
writing the xml by hand would be madness...
i didnt want to spend all night screwing around w/ it, since i dont have
any credentials to test w/, but if you look on the auth.net website you
will see they have a robust api in several languages, including php,
that happens to use the SoapClient class from php5.
there is a nice manual,
http://www.authorize.net/support/CIM_SOAP_guide.pdf
in it i found the service call you have mentioned in your initial post,
at that point in the document is a link to sample code
http://developer.authorize.net/dscode/php_cim.zip
which should have everything you need to interact w/ the auth.net
services in php (at a cursory glance).
-nathan
--- End Message ---
--- Begin Message ---
Nathan Nobbe wrote:
On Jan 9, 2008 10:45 PM, Tim Traver <[EMAIL PROTECTED]> wrote:
Bastien,
I want to use PHP's built in classes for this so I don't have to
manually send xml to the api...
writing the xml by hand would be madness...
i didnt want to spend all night screwing around w/ it, since i dont have
any credentials to test w/, but if you look on the auth.net website you
will see they have a robust api in several languages, including php,
that happens to use the SoapClient class from php5.
there is a nice manual,
http://www.authorize.net/support/CIM_SOAP_guide.pdf
in it i found the service call you have mentioned in your initial post,
at that point in the document is a link to sample code
http://developer.authorize.net/dscode/php_cim.zip
which should have everything you need to interact w/ the auth.net
services in php (at a cursory glance).
-nathan
Hey Nathan,
Thanks...that's actually really funny, because they must have put the
PHP sample code for the CIM method in there within the last week,
because that was why I was writing my own SOAP stuff to interact with
them (using those manuals)...
The issue that I ended up running in to was that the SOAP calls I was
making were getting errors back, and I couldn't get anyone from
authorize.net to give me any support for what the issue was...
Hopefully, their PHP class will do the trick...
Thanks,
Tim.
--- End Message ---
--- Begin Message ---
How can I display the returned HTML contents of a cgi (Perl) script,
without get parameters?
--- End Message ---
--- Begin Message ---
Liam wrote:
How can I display the returned HTML contents of a cgi (Perl) script,
without get parameters?
Oh, this means that
1: It mustn't count as a http hit,
and 2: I need to only get what is between the <body> tags.
Thanks in advance.
--- End Message ---
--- Begin Message ---
On 1/9/08, Liam <[EMAIL PROTECTED]> wrote:
> Liam wrote:
> 1: It mustn't count as a http hit,
it's going to
> and 2: I need to only get what is between the <body> tags.
now you're just asking the list to code something for you...
my suggestions again:
look into rewriting it to be more reusable
look at http://us2.php.net/manual/en/function.tidy-get-body.php
it's CGI, it can be executed using perl on the shell, sometimes -
depends on what it actually does. however it may count as a "hit"
either way. CGI must be executed to work, just depends on if it's
going to be executed via the web (definately a hit) or the shell
(maybe/maybe not depending on what the script does)
--- End Message ---
--- Begin Message ---
OK, what I meant was
1) Not dump the contents to a file, as the cgi will dynamically show
different links every time, (it's a reciprocal linking script)
2) Not count as though the user manually navigated to that page (for my
sanity when checking the site statistics!)
and
3) I also need to know how to run a expression-ish thing so that when I
'parse' the text, it returns all text between x and y, but parse it
BEFORE it gets 'included'.
Note: fOpen is NOT enabled, and I CAN'T enable it.
Thanks in advance
P.S. Sorry mike for my previous ungracious answer.
--- End Message ---
--- Begin Message ---
On 1/9/08, Liam <[EMAIL PROTECTED]> wrote:
> OK, what I meant was
> 1) Not dump the contents to a file, as the cgi will dynamically show
> different links every time, (it's a reciprocal linking script)
> 2) Not count as though the user manually navigated to that page (for my
> sanity when checking the site statistics!)
> and
> 3) I also need to know how to run a expression-ish thing so that when I
> 'parse' the text, it returns all text between x and y, but parse it
> BEFORE it gets 'included'.
>
> Note: fOpen is NOT enabled, and I CAN'T enable it.
>
> Thanks in advance
> P.S. Sorry mike for my previous ungracious answer.
what language are you comfortable in?
obviously perl is supported on your server.
i would recommend if you know perl, to stick with what you know and
integrate it together.
otherwise it sounds like you've got a handful of requirements (and
scope creep), no clue where to start, and no PHP knowledge to boot.
this is where i think you decide to just "pay someone to do it quick"
:)
1) rentacoder.com
2) phparch.com forums i think has a jobs area
anyway, expression stuff can be done using php.net/preg, php.net/ereg
and if possible, just normal str* functions. first you need to get the
content though and if you can't get that, i'm not sure that's going to
help any more ...
--- End Message ---
--- Begin Message ---
My non-profit setup makes that 'Pay Someone' alternative. What I am
planning on doing:
When the script is called, it is equivilent of using the want=ssilinks
GET parameter.
So therefore, all I need to do is get the HTML returned from the script,
not the contents of the script itself. Can anyone help now?
--- End Message ---
--- Begin Message ---
you're still issuing an HTTP request to get it, or executing perl on
the command line...
if it's a true non-profit 503(c)(3), you could offer someone the
chance to write off their services... non-profits may not have a lot
of money to spare but they do typically have money to fund things in
the organization's interests... hopefully.
On 1/9/08, Liam <[EMAIL PROTECTED]> wrote:
> My non-profit setup makes that 'Pay Someone' alternative. What I am
> planning on doing:
>
> When the script is called, it is equivilent of using the want=ssilinks
> GET parameter.
>
> So therefore, all I need to do is get the HTML returned from the script,
> not the contents of the script itself. Can anyone help now?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
OK, what I meant was
1) Not count as though the user manually navigated to that page (for my
sanity when checking the site statistics!)
and
2) I also need to know how to run a expression-ish thing so that when I
'parse' the text, it returns all text between x and y, but parse it
BEFORE it gets 'included'.
Note: fOpen is NOT enabled, and I CAN'T enable it.
Thanks in advance
P.S. Sorry mike for my previous ungracious answer.
--- End Message ---
--- Begin Message ---
mike wrote:
you're still issuing an HTTP request to get it, or executing perl on
the command line...
if it's a true non-profit 503(c)(3), you could offer someone the
chance to write off their services... non-profits may not have a lot
of money to spare but they do typically have money to fund things in
the organization's interests... hopefully.
Well, heh, I am really the only person behind my organization, and I'm
under 18, so I can't get a PayPal account or whatever and accumulate
donations either.
However, I did find a cURL solution: this is the code behind it for
anyone else who had/has this problem:
<?php
$ch = curl_init();
curl_setopt($ch,
CURLOPT_URL,"http://goldenlightsoft.org/cgi-bin/lt/linktrade.cgi?want=ssilinks");
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$result=curl_exec ($ch);
curl_close ($ch);
echo $result
?>
Now, I just need to look into parsing the text.
Thanks everyone for your assistance, I'll be sure to come back here and
frustrate you with any future problems I have. :] :P
--- End Message ---
--- Begin Message ---
yeah - well you said you can't issue an http request
although it depends - if your reporting is
javascript/browser-executable, or if it's a server-side increment. if
it's javascript, no worries, the curl request won't execute it.
On 1/10/08, Liam <[EMAIL PROTECTED]> wrote:
> mike wrote:
> > you're still issuing an HTTP request to get it, or executing perl on
> > the command line...
> >
> > if it's a true non-profit 503(c)(3), you could offer someone the
> > chance to write off their services... non-profits may not have a lot
> > of money to spare but they do typically have money to fund things in
> > the organization's interests... hopefully.
>
> Well, heh, I am really the only person behind my organization, and I'm
> under 18, so I can't get a PayPal account or whatever and accumulate
> donations either.
>
> However, I did find a cURL solution: this is the code behind it for
> anyone else who had/has this problem:
>
> <?php
> $ch = curl_init();
> curl_setopt($ch,
> CURLOPT_URL,"http://goldenlightsoft.org/cgi-bin/lt/linktrade.cgi?want=ssilinks");
> curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
> $result=curl_exec ($ch);
> curl_close ($ch);
> echo $result
> ?>
>
> Now, I just need to look into parsing the text.
>
> Thanks everyone for your assistance, I'll be sure to come back here and
> frustrate you with any future problems I have. :] :P
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
mike wrote:
yeah - well you said you can't issue an http request
although it depends - if your reporting is
javascript/browser-executable, or if it's a server-side increment. if
it's javascript, no worries, the curl request won't execute it.
On 1/10/08, Liam <[EMAIL PROTECTED]> wrote:
mike wrote:
you're still issuing an HTTP request to get it, or executing perl on
the command line...
if it's a true non-profit 503(c)(3), you could offer someone the
chance to write off their services... non-profits may not have a lot
of money to spare but they do typically have money to fund things in
the organization's interests... hopefully.
Well, heh, I am really the only person behind my organization, and I'm
under 18, so I can't get a PayPal account or whatever and accumulate
donations either.
However, I did find a cURL solution: this is the code behind it for
anyone else who had/has this problem:
<?php
$ch = curl_init();
curl_setopt($ch,
CURLOPT_URL,"http://goldenlightsoft.org/cgi-bin/lt/linktrade.cgi?want=ssilinks");
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$result=curl_exec ($ch);
curl_close ($ch);
echo $result
?>
Now, I just need to look into parsing the text.
Thanks everyone for your assistance, I'll be sure to come back here and
frustrate you with any future problems I have. :] :P
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
It's a server side log thing.
--- End Message ---
--- Begin Message ---
On Jan 10, 2008 4:00 AM, Liam <[EMAIL PROTECTED]> wrote:
> >> Thanks everyone for your assistance, I'll be sure to come back here and
> >> frustrate you with any future problems I have. :] :P
That's fine, and it's for that reason this list exists, but here's
a couple of pointers:
1.) Keep the attitude and sarcasm to a minimum (or follow it by a
smiley face so it looks like you're not that rude).
2.) Keep ALL RELATED POSTS in one thread. It was a little
overboard to have to follow your conversation across five separate
threads, and that doesn't help people searching on Google (or directly
in the archives) use your experience to solve a similar problem.
Aside from that, parsing the text should be no problem. Depending
on what you want to do, regexps are probably the way you want to do
it, just as a heads-up. For that, look into the preg_*() and ereg()
families.
--
</Dan>
Daniel P. Brown
Senior Unix Geek and #1 Rated "Year's Coolest Guy" By Self Since 1979.
--- End Message ---
--- Begin Message ---
Is there any functionality in PHP similar to closures?
Are there any plans to add it..?
--- End Message ---
--- Begin Message ---
John Papas schreef:
> Is there any functionality in PHP similar to closures?
>
> Are there any plans to add it..?
read the archives of the php internals or all posts pertaining to closures,
that will answer all your questions.
>
--- End Message ---