473,396 Members | 2,039 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

un php script and excpect an answer

I have a PHP page that I would like to run with cron but that's not the
problem. My problem come when I run my script throw my browser the
script runs properly but when I try to run the script using either php,
lynx or wget the script starts but once the request is made the script
stops running. EX.: I get a client from my database and send a request
to my billing company to get the status of is invoice.

So basically the script never comes back with an answer.

Sep 13 '05 #1
8 1570
My problem come when I run my script throw my browser the
script runs properly but when I try to run the script using either php,
lynx or wget the script starts but once the request is made the script
stops running.


Does your page depend on javascript in any way? This would not be
executed by cron, wget, or command line PHP (not sure about lynx).

---
Steve

Sep 13 '05 #2
> My problem come when I run my script throw my browser the
script runs properly but when I try to run the script using either php,
lynx or wget the script starts but once the request is made the script
stops running.


No it's simply PHP

Sep 14 '05 #3
My problem come when I run my script throw my browser the
script runs properly but when I try to run the script using either php,
lynx or wget the script starts but once the request is made the script
stops running.


Then, you should create the smallest possible script that reproduces
the problem, and then post it here.

By that I mean that you should make a copy of your faulty script, and
progressively remove code from it until it no longer fails in the way
you describe. The last thing you take out will probably give you a clue
about the cause of the problem. If it doesn't, put it back in and post
the short script here (and tell us what the last thing was!)

---
Steve

Sep 14 '05 #4
> Then, you should create the smallest possible script that reproduces
the problem, and then post it here. By that I mean that you should make a copy of your faulty script, and
progressively remove code from it until it no longer fails in the way
you describe. The last thing you take out will probably give you a clue
about the cause of the problem. If it doesn't, put it back in and post
the short script here (and tell us what the last thing was!)


For security reasons I cannot post my script. But my script is in no
way faulty has it run like it should throw a browser but like I said
before when I execute it in my browser it runs with no problem and has
soon has I try to execute it throw the command line the script starts,
sends the request and ends and will not continue but it ends with no
error. So I have no clue why do I have to specify in the command line
that it's a recursive script or ...???

I can probably do an example here (this is just a brief example to help
you guys):

// receives the request from the billing company and updates the
// invoice status of the client but for the first execution there is
// nothing so does not go in the if
If($_GET['status']){
// execute a DB operation to set the invoice status
}

// verify that there is a next client and fetch is it
$value = 'customers_id='.$customers_id.'&'.
'invoiceType='.$inv_type.'&'.....

//Sends a request to the billing company
redirect('https://portal?'.$value);

// The script has ended

Sep 14 '05 #5
redirect('https://portal?'.$value);


This is the source of the problem. lynx and wget will both have
problems following the redirection although the rest of the script will
have been executed.

Why not use PHP instead? 8-) fopen() will follow redirections...
<?php
$file = fopen( "http://www.php.net/fopen", "r" );
if( !$file )
{
print "fopen() failed";
exit;
}
while( !feof( $file ) )
{
$html = fgets( $file, 1024 );
print $html;
}
fclose( $file );
?>
---
Steve

Sep 14 '05 #6
Steve so you want me to create a script that open's my other script and
execute it right???

Sep 14 '05 #7
Steve so you want me to create a script that open's my other script and
execute it right???


That might be one way round your problem. Going back to what you are
trying to do - execute a PHP script via cron - the limitations of wget
and lynx prevent you from executing it directly. Assuming you can't
remodel your script to avoid the redirection, instead you have an
intermediary script call the main script from cron:

wget http://www.example.com/myscriptcaller.php

myscriptcaller.php is the simple fopen()/fread()/fclose() script from
earlier in this thread, set to call your main script.

---
Steve

Sep 15 '05 #8
I actually tried it but the fopen has to point to the physical
I tried it but the fopen has to point to the physical file on the
server like "/www/html/myscript.php" because if I put the url to the
file it gives me an error and if I put the physical path to the file
"/www/html/myscript.php" it simply print out the lines and that's it.

Steve wrote:
Steve so you want me to create a script that open's my other script and
execute it right???


That might be one way round your problem. Going back to what you are
trying to do - execute a PHP script via cron - the limitations of wget
and lynx prevent you from executing it directly. Assuming you can't
remodel your script to avoid the redirection, instead you have an
intermediary script call the main script from cron:

wget http://www.example.com/myscriptcaller.php

myscriptcaller.php is the simple fopen()/fread()/fclose() script from
earlier in this thread, set to call your main script.

---
Steve


Sep 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Michael | last post by:
Hi, I am looking for a poll script with a special feature. Normally poll scripts display for every answer option ONE bar according to how many votes the answer got. I am looking for a script...
11
by: Fuzzyman | last post by:
What's the best, cross platform, way of finding out the directory a script is run from ? I've googled a bit, but can't get a clear answer. On sys.argv the docs say : argv is the script name...
4
by: Prodip Saha | last post by:
Dear ASP.NET Gurus, I have a TextBox control with AutoPostBack set to true to execute the server scripts. I also, added some client script for validation.What I want is--execute the client script...
7
by: gorkos | last post by:
Hi, I am two days trying to solve a problem with some pages, which i get through HTTPWebRequest. Error is that some pages need Script to be enabled. But how to do this in HTTPWebRequest class?
33
by: patrick_woflian | last post by:
hey guys, im just writing a basic calculation at the moment, before building on it for an A-Level piece of work. i can add/divide etc... two numbers together yet i am having a major problem with...
6
by: Angelos | last post by:
Hello, For long time now I am trying to POST some variables from a form to a script and then that script POST them to another External page or payment gateway like worldpay. The reason I want...
2
by: Kingo | last post by:
Hi, First, please forgive my terrible knowledge of JS! I haven't used it in years. I am trying to create a Help page where a new question is on each line, and when clicking on the question,...
2
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I run a server side script? ----------------------------------------------------------------------- You...
9
by: habilatate83 | last post by:
why wont this script work, i added the operator2 variable an it stopped working <html> <head> <title>A Metric/Imperial Converter</title> </head> <body> <?php
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.