Re: [PHP] PHP CURL JSON POST Firebug

2012-09-09 Thread ioan...@btinternet.com



On 04/09/2012 19:14, ioan...@btinternet.com wrote:



On 04/09/2012 18:41, Matijn Woudt wrote:

On Tue, Sep 4, 2012 at 7:35 PM, ioan...@btinternet.com
ioan...@btinternet.com wrote:

I am hoping someone can spot what is missing here.  I am getting null
result
from curl-ing a page with json post variables.

I try this url in my Firefox browser -

http://www.targetsite.com/search.php#somevar.someothervar

(#somevar.someothervar are irrelevant, I think, as I get the curl
variables
from Firebug below.)

In Firebug, this shows:

POST http://www.targetsite.com/ajax/search.xml

In Firebug, below this link are tabs for: Headers, Post, Response,
XML and
Cookies.  Post tab shows like:

JSON
VAR1   1
VAR2   2012-09-12
VAR3   null
CACHED []
OPTIONSnull

To prove there is output, the Firebug Response tab shows:

?xml version=1.0 encoding=utf-8?
JSON various JSON encoded stuff /JSON

The above is what I am trying to curl.

My php code:

   $ch = curl_init();
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
   curl_setopt($ch, CURLOPT_POST, 1);

   //target page from Firebug above:
   curl_setopt($ch, CURLOPT_URL,
http://www.targetsite.com/ajax/search.xml;);

   //I was not sure how to represent CACHED [], so set it to null

try CACHED=array()

   $data = array(
 VAR1 = 1,
 VAR2 = 2012-09-12,
 VAR3 = null,
 CACHED=null,
 OPTIONS=null,
   );
   curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

   //make the request
   $result = curl_exec($ch);

   //this returns null

Any ideas where to go with this?  Maybe I need to include the
Cookies? I use
the above php and curl functions normally so it's all installed on the
server.

John


It might be that the site is using sessions/cookies. Have a look at
the header data with firebug.
Not sure if that's the problem, to find out what's really going on, call
echo curl_error($ch);
after curl_exec to find out what went wrong exactly.
If you still don't know how to proceed, paste the result of the
curl_error call in your reply.

- Matijn


I added the cookies to the post array.  I changed php array to
CACHED=array() for the JSON CACHED:[], and corrected php's null to
NULL.  It is not returning any error.  The browser was showing 'resource
not present' before I added the cookies to the post array, now it just
returns null $result.  Looks like I am transcribing something incorrectly.

John



I eventually sorted this out.  Solution involved:

POST params needed to be json_encoded
$params=json_encode(array(
name = value
));

Thanks to 
http://www.lornajane.net/posts/2011/posting-json-data-with-php-curl


curl_setopt($ch, CURLOPT_CUSTOMREQUEST, POST);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);

Also, included headers as array and set application type as json:
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($post))
);

Set encoding to auto-detect:
curl_setopt( $ch, CURLOPT_ENCODING, );


John

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



[PHP] PHP CURL JSON POST Firebug

2012-09-04 Thread ioan...@btinternet.com
I am hoping someone can spot what is missing here.  I am getting null 
result from curl-ing a page with json post variables.


I try this url in my Firefox browser -

http://www.targetsite.com/search.php#somevar.someothervar

(#somevar.someothervar are irrelevant, I think, as I get the curl 
variables from Firebug below.)


In Firebug, this shows:

POST http://www.targetsite.com/ajax/search.xml

In Firebug, below this link are tabs for: Headers, Post, Response, XML 
and Cookies.  Post tab shows like:


JSON
VAR1   1
VAR2   2012-09-12
VAR3   null
CACHED []
OPTIONSnull

To prove there is output, the Firebug Response tab shows:

?xml version=1.0 encoding=utf-8?
JSON various JSON encoded stuff /JSON

The above is what I am trying to curl.

My php code:

  $ch = curl_init();
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_POST, 1);

  //target page from Firebug above:
  curl_setopt($ch, CURLOPT_URL, 
http://www.targetsite.com/ajax/search.xml;);


  //I was not sure how to represent CACHED [], so set it to null
  $data = array(
VAR1 = 1,
VAR2 = 2012-09-12,
VAR3 = null,
CACHED=null,
OPTIONS=null,
  );
  curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

  //make the request
  $result = curl_exec($ch);

  //this returns null

Any ideas where to go with this?  Maybe I need to include the Cookies? 
I use the above php and curl functions normally so it's all installed on 
the server.


John

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



Re: [PHP] PHP CURL JSON POST Firebug

2012-09-04 Thread ioan...@btinternet.com



On 04/09/2012 18:41, Matijn Woudt wrote:

On Tue, Sep 4, 2012 at 7:35 PM, ioan...@btinternet.com
ioan...@btinternet.com wrote:

I am hoping someone can spot what is missing here.  I am getting null result
from curl-ing a page with json post variables.

I try this url in my Firefox browser -

http://www.targetsite.com/search.php#somevar.someothervar

(#somevar.someothervar are irrelevant, I think, as I get the curl variables
from Firebug below.)

In Firebug, this shows:

POST http://www.targetsite.com/ajax/search.xml

In Firebug, below this link are tabs for: Headers, Post, Response, XML and
Cookies.  Post tab shows like:

JSON
VAR1   1
VAR2   2012-09-12
VAR3   null
CACHED []
OPTIONSnull

To prove there is output, the Firebug Response tab shows:

?xml version=1.0 encoding=utf-8?
JSON various JSON encoded stuff /JSON

The above is what I am trying to curl.

My php code:

   $ch = curl_init();
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
   curl_setopt($ch, CURLOPT_POST, 1);

   //target page from Firebug above:
   curl_setopt($ch, CURLOPT_URL,
http://www.targetsite.com/ajax/search.xml;);

   //I was not sure how to represent CACHED [], so set it to null

try CACHED=array()

   $data = array(
 VAR1 = 1,
 VAR2 = 2012-09-12,
 VAR3 = null,
 CACHED=null,
 OPTIONS=null,
   );
   curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

   //make the request
   $result = curl_exec($ch);

   //this returns null

Any ideas where to go with this?  Maybe I need to include the Cookies? I use
the above php and curl functions normally so it's all installed on the
server.

John


It might be that the site is using sessions/cookies. Have a look at
the header data with firebug.
Not sure if that's the problem, to find out what's really going on, call
echo curl_error($ch);
after curl_exec to find out what went wrong exactly.
If you still don't know how to proceed, paste the result of the
curl_error call in your reply.

- Matijn

I added the cookies to the post array.  I changed php array to 
CACHED=array() for the JSON CACHED:[], and corrected php's null to 
NULL.  It is not returning any error.  The browser was showing 'resource 
not present' before I added the cookies to the post array, now it just 
returns null $result.  Looks like I am transcribing something incorrectly.


John

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



Re: [PHP] Read dynamic variable from HTML form into PHP

2012-06-08 Thread ioan...@btinternet.com



There are essentially 2 ways:
1. All POSTed data is present in the $_POST superglobal array. So you
could just loop over that, ignore the fields you already knew were there,
and the data remaining is then essentially the data you seek. The keys in
the $_POST array are the fieldnames you are looking for.

2. There's a special trick in PHP, when you name a field name[] in HTML
and then POST it to a PHP script, it will turn into an array field. So
input name=a[] value=1  input name=a[] value=2  will then end up
in:
$_POST = [
'a' =  [
   0 =  '1',
   1 =  '2'
]
]

If you had not added the square-brackets, you would have:
input name=a value=1  input name=a value=2  ending up in:
$_POST = [
'a' =  '2'
]
Thus not ever seeing the value '1'.





form
checkbox field name=input_1 value=y
checkbox field name=input_2 value=y
field name input_n
..
/form

?
//checkboxes return on submit only if ticked
$query=SELECT id FROM table WHERE etc;
$result=mysql_db_query($db, $query,$connection);
$count=mysql_num_rows($result);
while($row=mysql_fetch_row($result)) {
$id=$row[0];
//dynamic variable
//if form uses textfield that returns on submit
//if(${input_.$id}==1){
//if checkbox that only returns if ticked
if(ISSET(${input_.$id})){
echo checked 1;
}
}
?

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



Re: [PHP] Re: Google spreadsheet curl

2010-08-10 Thread ioan...@btinternet.com



On 2010/08/10 6:24, ioan...@btinternet.com wrote:

I have uploaded Zend to my site but the files within the package do not
seem to find each other:



I solved this by correcting the include path (should be to the library 
folder (with no trailing slash)).  I get as far as a menu offering to 
list docs, query or upload.  However, clicking these options doesn't do 
anything, but I will take up the issue with a Zend group.  Unless anyone 
here knows an easier way to curl download a google spreadsheet...?


John

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



Re: [PHP] Re: Google spreadsheet curl

2010-08-09 Thread ioan...@btinternet.com
This is a new message, not an existing thread.  I don't know where the 
Re: got into the subject.  Perhaps I sent it to myself first.


Anyway, answer may have something to do with getting Zend installed.

John

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



Re: [PHP] Re: Google spreadsheet curl

2010-08-09 Thread ioan...@btinternet.com
I have uploaded Zend to my site but the files within the package do not 
seem to find each other:


Warning: include_once(Zend/Gdata.php) [function.include-once]: failed to 
open stream: No such file or directory in 
/home/mysite/Zend/library/Zend/Loader.php on line 146


The line 146 is;

if ($once) {
include_once $filename;

The code goes as below and I am wondering what is this trying to say 
about $filename, it says: * @param  string$filename as a 
comment, and then uses $filename without defining it. Am I supposed to 
provide this?


This seems a lot of effort just to download a google spreadsheet with curl.

===
/**
 * Loads a PHP file.  This is a wrapper for PHP's include() function.
 *
 * $filename must be the complete filename, including any
 * extension such as .php.  Note that a security check is 
performed that

 * does not permit extended characters in the filename.  This method is
 * intended for loading Zend Framework files.
 *
 * If $dirs is a string or an array, it will search the directories
 * in the order supplied, and attempt to load the first matching file.
 *
 * If the file was not found in the $dirs, or if no $dirs were 
specified,

 * it will attempt to load it from PHP's include_path.
 *
 * If $once is TRUE, it will use include_once() instead of include().
 *
 * @param  string$filename
 * @param  string|array  $dirs - OPTIONAL either a path or array of 
paths

 *   to search.
 * @param  boolean   $once
 * @return boolean
 * @throws Zend_Exception
 */
public static function loadFile(c, $dirs = null, $once = false)
{
self::_securityCheck($filename);

/**
 * Search in provided directories, as well as include_path
 */
$incPath = false;
if (!empty($dirs)  (is_array($dirs) || is_string($dirs))) {
if (is_array($dirs)) {
$dirs = implode(PATH_SEPARATOR, $dirs);
}
$incPath = get_include_path();
set_include_path($dirs . PATH_SEPARATOR . $incPath);
}

/**
 * Try finding for the plain filename in the include_path.
 */
if ($once) {
include_once $filename;
===

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



[PHP] Re: Google spreadsheet curl

2010-08-08 Thread ioan...@btinternet.com

Using this code I get error message:



The spreadsheet at this URL could not be found. Make sure that you 
have the right URL and that the owner of the spreadsheet hasn't 
deleted it.


I have set up a test spreadsheet and it exists.  Any ideas on why this 
might be?


?php
   $key=[key from google spreadsheet URL;
  $url = [well known 
protocol][colon][[forwardslash]forwardslash]spreadsheets.google.com/feeds/cells/$key/1/public/values; 


  $ch = curl_init();

  // set URL and other appropriate options
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_HEADER, 0);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);

  // grab URL and pass it to the browser
  $google_sheet = curl_exec($ch);
  print(brgoogle_sheet: $url);
  print($google_sheet);


etc
?


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



Re: [PHP] CURL cannot connect to URL - IP address - after successful connection

2010-04-29 Thread ioan...@btinternet.com



On 2010/04/29 19:46, Gary . wrote:

On 4/25/10, ioan...@btinternet.com wrote:

I can return a target page - once, but then on refresh within a few
hours the script curl_error is that it cannot connect to the host and
return is empty.


Failed to connect to host is a pretty strange error if they're doing
anything regarding cookies and so on, IMO - I think I'd expect at
least a connection to be established before they decide they don't
like you. Have you used curl's --trace  --trace-ascii options?


Is that debug_backtrace() in php, as I am not using the command line 
(can't work out how to get the window up having downloaded curl, I am 
not up to 'building libraries' that seems to be needed).


debug_backtrace() does not give any useful information other than saying 
the target link fails to connect (this is after it connects once, and 
then on refresh and for several hours does not connect). I guess there 
is some program that notes the calling IP address and if it is in a 
range it does not like, adds it to a list and refuses subsequent 
connections to the same address for a while.  Cookies are not required 
when using the browser directly.


John

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



Re: [PHP] CURL cannot connect to URL - IP address - after successful connection

2010-04-28 Thread ioan...@btinternet.com
I think the answer is: ISPs have a different range of addresses from 
host providers, so it is possible to block requests from host servers, 
so from scripts.


John

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



Re: [PHP] CURL cannot connect to URL - IP address - after successful connection

2010-04-26 Thread ioan...@btinternet.com




Just to eliminate all possibilities, are you to open the same URL/URI in

the

web pages repeatedly?  Also, what happens when you fake the user agent in
the web browser?  The target site may have some anti bot mechanism in
place to reduce stress/load on the server(s).

Regards,
Tommy


One more thing, check it with cookies enabled/disabled in the web browser
too.




Having deleted cookies on the browser and disabled them, it still does 
not like various user agents:


	$useragent = array('Mozilla','Opera','Microsoft Internet 
Explorer','ia_archiver');
	$os = array('Windows','Windows XP','Linux','Windows NT','Windows 
2000','OSX');

//random user agent code
	$agent = $useragent[rand(0,3)].'/'.rand(1,8).'.'.rand(0,9).' 
('.$os[rand(0,5)].' '.rand(1,7).'.'.rand(0,9).'; en-US;)';

//would give something like Mozilla/3.5 (Windows 5.4; en-US;)

-- OR --

	//$useragent='Google Image - Googlebot-Image/1.0 ( 
http://www.googlebot.com/bot.html)';
	//$useragent=MSN Live - msnbot-Products/1.0 
(+http://search.msn.com/msnbot.htm);


--  OR --
	//$agent = DocZilla/1.0 (Windows; U; WinNT4.0; en-US; rv:1.0.0) 
Gecko/20020804;


I am just calling the page manually, once at a time.  It is probable 
that there is some anti-bot measures.  Page would probably not want to 
be indexed as it is providing ever changing content.  How to use this 
for normal level of use for real user just in a different site?


John

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



Re: [PHP] CURL cannot connect to URL - IP address - after successful connection

2010-04-26 Thread ioan...@btinternet.com



On 2010/04/26 20:01, Ashley Sheridan wrote:



How frequently do you request the page? Maybe playing about with that
would resolve it? Is it possible to randomise the request frequency a
bit?

Thanks,
Ash
http://www.ashleysheridan.co.uk



Just manually for testing, and it would be used for human requests.  Say 
occasionally 5, 10, 30 minutes intervals etc.  There must be other 
parameters that are being passed so that the site can determine that the 
request is coming from the same user and through a script request, 
because it works normally from the browser so just refusing a second 
call from the same IP address (which could be a browser with static or 
unchanged IP address) is not what is happening.  It must be determining 
that it is through a server from another site via curl or similar.


John

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



[PHP] CURL cannot connect to URL - IP address - after successful connection

2010-04-25 Thread ioan...@btinternet.com
I can return a target page - once, but then on refresh within a few 
hours the script curl_error is that it cannot connect to the host and 
return is empty.  The target URL is an ip address, not a named url, so 
maybe it has something to do with DNS.  I am on a shared server.  Any 
ideas on why this happens?


John

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



Re: [PHP] CURL cannot connect to URL - IP address - after successful connection

2010-04-25 Thread ioan...@btinternet.com


This is all I see in the error log:

SUEXEC error_log:


[2010-04-25 16:45:42]: uid: (1116/myname) gid: (1118/myname) cmd: 
fcgiwrapper



John

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



Re: [PHP] PHP 5.2.9 Apache 2.2.11 outputs php code on Vista

2009-06-27 Thread ioan...@btinternet.com
Solved: In Windows 'Explorer' in Vista, set User permissions for the 
htdocs - go to htdocs folder within the Apache folders, right click, 
Properties, Security, Edit, select your name as User, allow Full 
Control, Modify etc.  Now open the files you created like test.php or 
index1.html and save them again.  Then they will be accessible like 
http://localhost/test.php etc.  Whereas without this they will be 'file 
not found'.


Even if there is only one User in Windows and it is also the 
Administrator, you need to be recognised as Administrator for the action 
being done, normal log on to Windows will be as User only.


I got to the above solution when I noticed the 
http://localhost/index.html showed Apache working, in the browser using 
the index.html that comes with the installation, but index1.html saved 
in the same folder did not appear in Windows Explorer and also was 'page 
not found' in the browser, even though it saved OK and was visible and 
loadable in the html editor. 

php now also works with Apache, I think I was missing from httpd.conf 
within IfModule mime_module /IfModule:


   AddHandler application/x-httpd-php .php
   AddHandler application/x-httpd-php-source .phps


John

ioan...@btinternet.com wrote:
I still have the strange thing of saving a file in htdocs within the 
Apache folders (on Vista, you need to right click on Notepad from 
Start and Run as Administrator), but then not seeing it in Windows 
Explorer - must be something to do with UAC.  But main problem is 
getting php to work with Apache.  Please let me know if there is 
anywhere else I should look.  I took the time to read the php 
installation notes carefully and the Apache notes (which seemed to be 
mostly about meeting someone in a computer fair to check their 
fingerprint, I joke), but to no avail.


Does anyone have a working, full, step-by-step set of instructions for 
Vista, PHP 5.2.9 Apache 2.2.11 ?


Thanks,

John


Original post [ed]

I have a working Apache 2.2.11 server and php 5.2.9 installed.

APACHE CONFIGURATION

Files are in: C:/Program Files/Apache Software Foundation/Apache2.2/
 
As per installation instructions, Apache httpd.conf is amended to add 
at the end of the LoadModule lines (though not between any tags):


   LoadModule php5_module C:/PHP/php5apache2_2.dll

   PHPIniDir C:/PHP

And at the end of the file:

   AddModule mod_php5.c

(Would this be .conf, not .c?). , (per php notes 'Installing as an 
Apache module').  On clicking Start Apache http server, this gives 
Invalid command 'AddModule' perhaps misspelled or defined by a module 
not included in server configuration.  The PHP Installation guide 
says to add this at the end of the AddModule section.  There is no 
AddModule in the default http.conf of Apache 2.2.11.  So for now have 
commented it out.


Between IfModule mime_module and /IfModule, I have added:

   AddType application/x-httpd-php .php


PHP CONFIGURATION

The php.ini file is in C:/PHP.

php.ini has been amended as follows:
doc_root = C:\Program Files\Apache Software Foundation\Apache2.2\htdocs

WINDOWS CONFIGURATION

I have added ;C:/PHP to the end of the string for Environment Variables.

I have re-booted and re-started.  I am testing this file:

C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test.php

which has
?
print(test);
?

and this outputs as code rather than as 'test' or it does not output 
at all.


When I start the Apache http server, I get:

httpd.exe: Could not reliably determine the server's fully qualified 
domain name

, using 10.0.0.4 for ServerName
(OS 10048)Only one usage of each socket address (protocol/network 
address/port)

is normally permitted.  : make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs

My ISP has a dynamic IP address system, what do I use for ServerName?  
Do I need a static address or registered web site name to run on home 
computer?


Apache httpd.conf has:
# ServerName gives the name and port that the server uses to identify 
itself.
# This can often be determined automatically, but we recommend you 
specify

# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP 
address here.

#
#ServerName

Any idea what might be wrong with the php code showing?

Thanks,

John






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



Re: [PHP] PHP 5.2.9 Apache 2.2.11 outputs php code on Vista

2009-06-27 Thread ioan...@btinternet.com

...though phpinfo seems to work fine without this handler.

ioan...@btinternet.com wrote:
php now also works with Apache, I think I was missing from httpd.conf 
within IfModule mime_module /IfModule:


   AddHandler application/x-httpd-php .php
   AddHandler application/x-httpd-php-source .phps


John




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



[PHP] PHP 5.2.9 Apache 2.2.11 outputs php code on Vista

2009-06-26 Thread ioan...@btinternet.com
I have a working apache 2.2.11 server and php 5.2.9 installed. 


APACHE CONFIGURATION
Files are in: C:/Program Files/Apache Software Foundation/Apache2.2/
Apache https.conf is amended to add at the end of the LoadModule lines 
(not between any tags):


   LoadModule php5_module C:/PHP/php5apache2_2.dll

   PHPIniDir C:/PHP

at the end of the file, though i cannot find any section called 
AddModule per the php installation notes ('Installing as an Apache module'):

   AddModule mod_php5.c
On clicking Start Apache http server, this gives Invalid command 
'AddModule' perhaps misspelled or defined by a module not included in 
server configuration.  The PHP Installation guide says to add this at 
the end of the AddModule section.  There is no AddModule in the default 
http.conf of Apache 2.2.11.  So for now have commented it out.


and between IfModule mime_module and /IfModule:

   AddType application/x-httpd-php .php

PHP CONFIGURATION
The php.ini file is in C:/PHP. 


php.ini:
doc_root = C:\Program Files\Apache Software Foundation\Apache2.2\htdocs

WINDOWS CONFIGURATION

I have added ;C:/PHP to the end of the string for Environment Variables.

I have re-booted and re-started.  I am testing this file:

C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test.php

which has
?
print(test);
?

and this outputs as code rather thna as 'test'.

When I start the Apache http server, I get:

httpd.exe: Could not reliably determine the server's fully qualified 
domain name

, using 10.0.0.4 for ServerName
(OS 10048)Only one usage of each socket address (protocol/network 
address/port)

is normally permitted.  : make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs

My ISP has a dynamic IP address system, what do I use for ServerName?  
Do I need a static address or registered web site name to run on home 
computer?


Apache httpd.conf has:
# ServerName gives the name and port that the server uses to identify 
itself.

# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address 
here.

#
#ServerName 


Any idea what might be wrong with the php code showing?

Thanks,

John




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



Re: [PHP] PHP 5.2.9 Apache 2.2.11 outputs php code on Vista

2009-06-26 Thread ioan...@btinternet.com

I meant httpd.conf.

And what is it about Vista that when in Notepad and you save a file, say 
test.php in directory htdocs, it shows test.php in the folder, but when 
you go to Windows Explorer there it is and it is gone?  Nor does it load 
as http://localhost/test.php although http://localhost/ loads as the 
index.html file which is in the same folder?


Pathetic notes on installation of Apache.

J.

ioan...@btinternet.com wrote:

I have a working apache 2.2.11 server and php 5.2.9 installed.
APACHE CONFIGURATION
Files are in: C:/Program Files/Apache Software Foundation/Apache2.2/
Apache https.conf is amended to add at the end of the LoadModule lines 
(not between any tags):


   LoadModule php5_module C:/PHP/php5apache2_2.dll

   PHPIniDir C:/PHP

at the end of the file, though i cannot find any section called 
AddModule per the php installation notes ('Installing as an Apache 
module'):

   AddModule mod_php5.c
On clicking Start Apache http server, this gives Invalid command 
'AddModule' perhaps misspelled or defined by a module not included in 
server configuration.  The PHP Installation guide says to add this at 
the end of the AddModule section.  There is no AddModule in the 
default http.conf of Apache 2.2.11.  So for now have commented it out.


and between IfModule mime_module and /IfModule:

   AddType application/x-httpd-php .php

PHP CONFIGURATION
The php.ini file is in C:/PHP.
php.ini:
doc_root = C:\Program Files\Apache Software Foundation\Apache2.2\htdocs

WINDOWS CONFIGURATION

I have added ;C:/PHP to the end of the string for Environment Variables.

I have re-booted and re-started.  I am testing this file:

C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test.php

which has
?
print(test);
?

and this outputs as code rather thna as 'test'.

When I start the Apache http server, I get:

httpd.exe: Could not reliably determine the server's fully qualified 
domain name

, using 10.0.0.4 for ServerName
(OS 10048)Only one usage of each socket address (protocol/network 
address/port)

is normally permitted.  : make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs

My ISP has a dynamic IP address system, what do I use for ServerName?  
Do I need a static address or registered web site name to run on home 
computer?


Apache httpd.conf has:
# ServerName gives the name and port that the server uses to identify 
itself.
# This can often be determined automatically, but we recommend you 
specify

# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP 
address here.

#
#ServerName
Any idea what might be wrong with the php code showing?

Thanks,

John






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



[PHP] Convert \x3d \x3b \x3c to ASCII

2009-06-23 Thread ioan...@btinternet.com
Is there a function which will convert characters like \x3d \x3b \x3c to 
ASCII.  Or is there a full list of conversions, eg \x3c=
\x3e=, \x27=' etc.  What are these, hex? I tried hexdec() but am not 
sure that is right.


John

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



[PHP] CURL intermittant problem

2009-06-11 Thread ioan...@btinternet.com
I have been having problems with a curl script which works normally with 
many different URLs but had a particular intermittant problem with a url 
in the following format:
http://10.20.30.40/0001/032/023112/filename.phtml?param1=paramvalue1param2=paramvalue2 
etc etc.


The unusual thing about this URL is that is starts with an IP address.  
I got a lot of failures to connect, so tried a different way to connect 
as all I need is the page as a string:


According to php.net, the function 'file_get_contents()' should work if 
allow_url_fopen is set to TRUE for the PHP installation.  
'allow_url_fopen' is set to 1 in my php.ini file.


http://php.net/file_get_contents
http://php.net/allow_url_fopen

However, 'file_get_contents' also fails to connect to this particular 
URL.  It gives:


failed to open stream: Connection timed out in 
*/home/shortsta/public_html/live48_test.php* on line *75*


*Warning*: feof(): supplied argument is not a valid stream resource in 
*/home/mysite/public_html/testpage.php* on line *79*


The target URL works perfectly and quicly if put directly into the 
browser URL line.


Do you know of any other reasons for problems with such a connection?

John

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