Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Odd Fsockopen Behavior


Any IP address I try to open with fsockopen on a particular server
seems to use another IP address instead.

eg. I open a socket connection to 192.168.1.1 but the remote_addr that
the other server sees is 192.168.1.255. It's as if, like I said, the
IP address I supply to fsockopen is being replaced with another one.

Anyway, this is breaking a script of mine. I don't think I can really
do a lot in PHP to fix this but is there perhaps some way that I can
detect it? Is there some command line parameter that I can pass to
passthru or something that'll tell me whether or not such a thing is
happening?

Also, how is this even being done? Could a firewall do this? If so,
I'm still not even sure how it'd be done...




View Complete Forum Thread with Replies

Related Forum Messages:
Warning: Fsockopen() [function.fsockopen]: SSL: Connection Reset By Peer In
I keep gettin this error when i submit on the form hosts say its all ok for them but isnt for me

Warning: fsockopen() [function.fsockopen]: SSL: Connection reset by peer in
/home/jaynbhav/public_html/msn/msnpauth.php on line 67

Warning: fsockopen() [function.fsockopen]:
php_stream_sock_ssl_activate_with_method: SSL handshake/connection failed in
/home/jaynbhav/public_html/msn/msnpauth.php on line 67

Warning: fsockopen() [function.fsockopen]: failed to activate SSL mode 1 in
/home/jaynbhav/public_html/msn/msnpauth.php on line 67

View Replies !
Odd Mt_srand Behavior
Apparently seeding mt_srand with different integers can produce identical
series of mt_rand results. Specifically, every pair of consecutive even and
odd numbers produces the same series - see below. This is a nuisance for
me. Am I doing something wrong? I'm using PHP 4.3.4 on a windows box.

mt_srand(0); echo " 0 new rnd =" . mt_rand() . " rnd =" . mt_rand() . " rnd
=" . mt_rand() . "<BR>";

mt_srand(1); echo " 1 new rnd =" . mt_rand() . " rnd =" . mt_rand() . " rnd
=" . mt_rand() . "<BR>";

mt_srand(2); echo " 2 new rnd =" . mt_rand() . " rnd =" . mt_rand() . " rnd
=" . mt_rand() . "<BR>";

mt_srand(3); echo " 3 new rnd =" . mt_rand() . " rnd =" . mt_rand() . " rnd
=" . mt_rand() . "<BR>";

mt_srand(4); echo " 4 new rnd =" . mt_rand() . " rnd =" . mt_rand() . " rnd
=" . mt_rand() . "<BR>";

mt_srand(100000); echo " 100000 new rnd =" . mt_rand() . " rnd =" .
mt_rand() . " rnd =" . mt_rand() . "<BR>";

mt_srand(100001); echo " 100001 new rnd =" . mt_rand() . " rnd =" .
mt_rand() . " rnd =" . mt_rand() . "<BR>";

mt_srand(100002); echo " 100002 new rnd =" . mt_rand() . " rnd =" .
mt_rand() . " rnd =" . mt_rand() . "<BR>";

mt_srand(100003); echo " 100003 new rnd =" . mt_rand() . " rnd =" .
mt_rand() . " rnd =" . mt_rand() . "<BR>";

mt_srand(100004); echo " 100004 new rnd =" . mt_rand() . " rnd =" .
mt_rand() . " rnd =" . mt_rand() . "<BR>";

produces

0 new rnd =1898087491 rnd =2091264893 rnd =1090025303
1 new rnd =1898087491 rnd =2091264893 rnd =1090025303
2 new rnd =1309289693 rnd =1266233749 rnd =2011030501
3 new rnd =1309289693 rnd =1266233749 rnd =2011030501
4 new rnd =265425943 rnd =110448983 rnd =1971643347
100000 new rnd =863778341 rnd =827028059 rnd =1038256368
100001 new rnd =863778341 rnd =827028059 rnd =1038256368
100002 new rnd =1020061831 rnd =477025457 rnd =1071505930
100003 new rnd =1020061831 rnd =477025457 rnd =1071505930
100004 new rnd =2050501876 rnd =406342065 rnd =79708900

View Replies !
Browser Like Behavior
What is the easiest way to use jakarta HttpClient 3.0 , to behave like
browser executing methods with sequential URLs?

View Replies !
Countinue Behavior
Is that a normal behavior of countinue?
Shouldn't it skip the echo?

-------------------------------------
<?
for ($i=0; $i < 10; $i++) {
countinue;
echo "bla";
}
?>
-------------------------------------

View Replies !
Odd Cookie Behavior
I'm processing a form, and on the target posting page, I'm setting
cookies for the name/value pairs like this:

while (list($name, $value) = each($HTTP_POST_VARS))
{
if ( $value <> NULL ) {
setcookie($name,$value,time()+3600*24*30*12*10);
$mystring = "<input type="hidden" value="$value" name="$name">

$mystring";
}
}

Now after posting when I go back to my original form with the same URL
path,

www.mydomain.com/mypath,

I can see that the cookies are there because the values appear in the
fields like we'd expect. However if I put the very same form in a
different directory, eg: www.mydomain.com/secondpath then the cookied
values no longer appear.

I knew that cookies could be domain specific, but is there a setting
that makes them somehow directory specific??

View Replies !
Array Behavior
I am trying to create a dropdown menu with options pulled from a MySQL database. I count the number of entries in the database, assign that to a variable, and then insert each entry into an array.

I then try to echo the HTML for each option using this loop(where $numdisplayed is the number of times the loop has run, and $quotees is the array that the options for the dropdown menu are stored in.):

while($numdisplayed < $numquotees){
echo '<option value="'
echo"$quotees[$numdisplayed]";
echo'">'
echo"$quotees[$numdisplayed]";
echo"</option>";
$numdisplayed++;
}

It seems as though you can't use a variable to refer to an array key. Any alternatives?

View Replies !
$PHP_SELF A Strange Behavior!?
As we know $PHP_SELF is a PHP predifined variable. It handles the current file name and extension. I have a file contains commonly used functions. it's named func.php. Inside some of these functions, I use $PHP_SELF. I perform include for this file in another file called index.php.The strange behavior is, in some code area $PHP_SELF does not return any value, in other word,
it does not return index.php. However, in other areas it works properly!

So What's the cause of this problem?
Is it bug in my PHP?
I use PHP Ver 4.2.3 on Apache, and windows ME. All this from phpdev423 package.

View Replies !
Strange Behavior With PHP Over HTTPS, On IE
I have a login.php and register.php inside our httpsdocs directory, that is the root of https:// path.

login.php and register.php both require_once a global.php file located inside httpdocs, the root of http://.

In Firefox and IE, viewing the page certificate of https://pathtosite/login.php will show our Equifax provider.

But, only on Firefox does it show the 256 bit-encryption lock icon in the status bar of the browser. For some reason this isn't showing in IE.

I created a blank index.php inside of httpsdocs, and accessed it at https://pathtosite/index.php, and in IE it shows the lock icon in the status bar.

Very strange. Is it because the files are referencing to global.php, which is located outside of https? I wouldn't think so... or is this just an IE issue?

View Replies !
Lack Of Suexec Behavior
suexec on old perl cgi processes was useful:
A cgi process (run by the apache process)
could create files that belonged to me.

Php usually runs as an '.so' library, owned by
the apache process, which is more efficient.
But it means all files (even in my filesystem
space) created by php/apache end up owned
by apache. This is an enormous pain the butt,
particularly when complicated by 'safe_mode'
restrictions.

Why can't the php kernel be hacked to fork
a full-fledged, separate process, that
uses setuid owner for certain key file system
chores: perhaps only for certain newly created functions,
like "mkUserOwnedDir() or openUserOwnedFile()"

View Replies !
Classes: Strange Behavior
I have a problem with code like this (PHP 5.1.4):

fila A.php:
=======
include(B.php);
class document extends obj {
.........
}

file B.php:
=======
$GLOBALS['x']->new we();
function __autoload($class_name) {
...here is the code to load classes...
}

file C.php
=======
class we extends obj {
private $document;
function __construct() {
$this->document = new document();
}
}

The problem is that after loading A.php into browser, PHP cannot find
document class which is defined in the A.php file! The problem is even
more strange - if document class doesnt extends obj class than
everything is ok.

(The problem exact is that __autoload special function is called when
in file C.php constructor of class we try to make the document object
(all other classes like obj has been already loaded).

Do you have any idea what is wrong with that?


View Replies !
What Is Php's Behavior When Connect To A Db?
What is php's behavior when connect to a db?

I've been told that php was once a dominant web programing language.
I've read a few chapters of a php book.

I was wonder what's php's performance.

Perl was once for a while a popular programming language for cgi.
But start very process per one web visit cause serioius problem to
system performance.

And then FASTCGI born.
I was impressed by its performance.

But recently i learn to do some php program which connect a mysql db.
It seems that the program run's very slow.

So, I have 2 questions:
1. does the os need to fork a php interpreter for every single web
request?
2. does the php connects to mysql all the time? that is does it need to
connect mysql
100 times when a user request the url 100 times?

If the answer if yes, i think that php's performance is unacceptable.

View Replies !
Funny Session Behavior
I am writing a foto upload site. A PHP page displays the uploades
fotos an the customer can choose several things. The data of the fotos
are kept in an array called bilder. I keep the data in a session. When
the customer send the data the following code will be run:

if (isset($sendorder_x))
{
session_start();
$nachricht = $bemerkungen;
session_register(nachricht);
// echo "1.: ";
// print_r($bilder); // The array still exists in the session file
// echo "<br>
2.: ";
for ($i = 1; $i <= $bildanzahl; $i++)
{
$formatname = "formate" . substr("00" . $i, -2);
$copyname = "copy" . substr("00" . $i, -2);
$bilder[$i]->format = $$formatname;
$bilder[$i]->anzahl = $$copyname;
}
// print_r($bilder); // bilder[] exists with the changed data in the
session file
// echo "<br>
3.: ";
$briefporto = $porto;
session_register(briefporto);
// session_register(bilder);
// print_r($bilder);
// exit(); // bilder[] exists with the changed data in the session
file
// echo "<br>
";
header("Location: datenupdate.php");
}

The page datenupdate.php starts with the fololwing code:

<?php
session_start();
// print_r($bilder);
// exit(); // all data is in the session file, but the array bilder[]
is empty now!
include ("database.php");
$dbid = connect();
.....

You can read in the comments, what happens. The lines, which start
with commenst, are for debugging.

Has anyone an idea, what the reason for tis behavior is? BTW, I use
PHP 5.1.4, Apache Server 2 on WinXP prof. SP2

And: This is no Easter Egg :-).

View Replies !
Strange Strtotime() Behavior
I'm trying to use the strtotime() function to manage sessions. But I
get the following

<?php
print(time() . " - " . strtotime("+1 hour"));
?>

outputs:

1097380666 - 1097308800

Strange strtotime("+1 hour") produced a time stamp less than the
current time. It also never changes. In other words strtotime("+1
hour") always results in the time stamp 1097308800.

I have also tried strtotime("+1 hour", time()) with the same result

Is this correct, have I misunderstood the strtotime() function?

I'm running Gentoo with kernal 2.6.8.1, php 5.0.1, apache2

View Replies !
Strange Class OOP Behavior
Anyone ever experienced this problem.

When i pass a mysql result to the constructor of a class and use that
resultset inside that class the original resultset outside the class gets
affected too. That is not right i think because my result inside my class is
private. Is this a bug? Can someone look at my code below please:

<?php

require_once('includes/connect.php');

class test {

private $_result;
private $_record;

public function __construct($result) {

$this->_result = $result;

}

public function show() {

while($this->_record = mysql_fetch_array($this->_result)) {

echo $this->_record['name'].'<br />'

}

}

}

# usage
# sql statement dat artikels ophaald uit cartal database
$SQL = "SELECT * FROM test_table";

# uitvoeren van dit statement
$RESULT = mysql_query($SQL,$conn);

$t = new test($RESULT);

$t->show();

// mysql_data_seek($RESULT,0);..

View Replies !
Strange Mysql_query Behavior
I have the following query:

$query = "select * from $tablename where lname like '$lname' order by lname" ;

Then I have:

$result = mysql_query($query);

The $lname is formed properly. I have an lname that is "Marshall". If the $lname is "Mar%" the select works. If the $lname is "Marsha%" it doesn't.

View Replies !
Strange PHP_SELF Behavior
I am migrating a self-made CMS app from one linux server to another and
i am getting very strange PHP_SELF behavior on the new server.

This app uses SEF URLs like http://domain.com/index.php/title/4/ (4
being the id)

When i use PHP_SELF in all the server but the new one i get as an
answer "/index.php/title/4/".

When i use it on the new server, i get "/title/4/"!!!!!!!
I am at a loss here. What could be triggering such a change? What
parameter should i change in the new server's config?

For info purposes, i'll attach the PHPInfo for both servers: the
working one and the new, not working one:

NOT working server:
http://new.microcar.es/phpinfo.php (PHP v4.3.11, Apache 1.3)

working server:
http://www.microcar.es/phpinfo.php (PHP v4.3.10, Apache 2.0)

Hint: You could try http://new.microcar.es/phpinfo.php/title/4/ and see
the result for yourself.

last info: i tried under another 1.3 server and it works well.

View Replies !
Php Equivalent To Perl's || Behavior?
one feature of perl I'm desparately missing in php is using || to assign
the first non-empty value in a list to a variable. For example,

# perl example 1
$a = 1;
$b = 2;
$c = $a || $b;
print $c; # displays 1

# perl example 2
$a = 1;
$b = 2;
$c = $d || $b;
print $c; # displays 2, since $d is empty

# perl example 3
$a = 'apple'
$b = 'banana'
$c = 'cherry'
$d = $a || $b || $c;
print $d; # displays 'apple'

# perl example 4
$a = ''
$b = ''
$c = 'cherry'
$d = $a || $b || $c;
print $d; # displays 'cherry'

This is such a handy language construct. Is there any such php
equivalent that accomplishes this? I've already written a function to do
it. (Like this: $d = value($a, $b, $c). But making value() visible
everywhere is something I'd rather avoid if there's something built-in
to php.)

View Replies !
How To Tell If Escape Behavior Is Turned On
Is there a programmatic way in PHP (using PHP 4) to tell if the
escaping apostraphes behavior is turned on when a request is submitted?
What I would like to do is insert a value into my db table, but only
apply escaping if PHP hasn't applied it for me ...

$v = $_REQUEST['val'];

if (escaping_disabled()) {
$v = escape($v);
}

insertIntoDB($v);

View Replies !
How To Save User's Behavior
I would like to record in a session (or in any other way) some array with user's behavior. But I need to save it on my machine in the moment the user is leaving, for I don't want to do it every time page is loaded. Is there any way to realize it?

View Replies !
Confusing POST Behavior -- Doing It Twice?
I am confused about what goes on with method POST. Here is an overview of a
my code, sketching it out:

<?php
if (isset($_POST['Submit']) && $_POST['Submit']=="Submit") {
---Do a bunch of stuff---
if (isset($_SESSION['Error'])) unset($_SESSION['Error']);
if (strcmp($A, "any") {
// Verify that a Zip code is numeric and is five digits
If (!is_numeric($_POST($zip)) strlen($_POST($zip)) != 5) then {
$_SESSION['Error'] = "an error description";
header("Location: thisSite.php:);
}
}
}
header("Location: anotherSite.php:);
?>

...... in the form description I have an
<?php if (isset(($_SESSION['Error'])) echo $_SESSION['Error']; ?>
(Note: The form is type POST).

So here is the problem:
1 - When I start, there is no error message.
2 - I deliberately put in a bad zip code and have a value other than "any"
in the A control and click to submit it.
3 - Instead of going back to thisSite.php and displaying the error message,
it goes to anotherSite.php.
4 - If I then hit the back arrow on the browser, it displays with the error
message on thisSite.php

It seems that
1 - on the submit it goes through the logic and sets the error.
2 - It then must be going through a second time, but this time taking on the
default setting of "any" for control A and so bypass the logic on the zip
code and so goes to anotherSite.php.

View Replies !
Text File Behavior
I have a question about the behavior of a text file thats being written and
read to.

Say Im using an XML file as the database for my little application. Users
come to my site and the file is read and parsed and coverted to some display
in html. On another page users can add information that updates this XML
file.

Is there any risk in this approach? While the XML file is being written to,
what is its readabililty? And vise-versa. Assuming Im using the standard
read write functions for files in PHP, will the read wait for a write to
finish, etc.

View Replies !
Odd Behavior Installing Extension
I've set up PHP 5.0.5.5 on an Windows 2003 system running IIS (yes yes,
have I considered Apache? Unable, other factors at play).

I wrote a simple test PHP that does nothing but phpinfo(), and it works
great. The moment I activate mysql support, trying to execute the
script results in a perpetual wait until timeout.

I have read http://www.php.net/manual/en/instal....extensions.php

My libmysql.dll is accessible to paths (copied to Windows as
experiment to make sure.

My extensions_dir is pointed at my ext dir, and if I insert gibberish
into it, launching PHP gives an error, so I know PHP has found and
parsed the file.

The crux is that things go to heck when I uncomment
extension=php_mysql.dll. Trying to run the test.php halts and goes no
further. If I comment that out again, everything works fine (except,
of course, for mysql).

View Replies !
Stumped By This Php Database Behavior
Consider:

while ($j < $num2) {
$parent_id=mysql_result($result2,$j,"parent_id");
$fam_first_name=mysql_result($result2,$j,"fam_first_name");
$fam_age=mysql_result($result2,$j,"fam_age");
echo "it is $parent_id";
echo "<tr id=$parent_id>";
echo "<td></td>";
echo "<td >$fam_first_name</td>";
echo "<td>$fam_age</td>";
echo "</tr>";
++$j;
}

The line that says "it is $parent_id" will print the variable.
The next parent id will skip one if it has two of the same values. I
know this may not make sense, but:

it is 1
it is 3
it is 3
it is 6

but the second three from above will never be in the tr id= tag. i
hope this makes sens. It just doesn't print in the tag if it has two
rows.

View Replies !
Wierd Login Behavior
I have a registration script that allows someon to register to my site. After the register they are taken to a login script which consists of a username and password field. Simple enough.

Here's the weird thing. They can login just fine. But only once!?! The next time they try and login in it fails to execute the query. Does this sound familiar to anyone?

View Replies !
Strange Date() Behavior
we are using date() in several contexts in our development. Now we get a quie strange looking error message. Can someone tell me, where it comes from? Code:

View Replies !
Weird Variable Behavior
I'm having an issue with some weird variable behavior. I could be overlooking something simple, but I figured I'd throw it out there since I can't seem to figure it out.

I have a page that takes a variable in from GET called $pageview, it basically decides whether or not you want your results, or everyones.

You load the page in view 1, your results, and if I echo $pageview at the top of the page, it displays "pageview: 1", ok all good. Code:

View Replies !
Inconsistant Cookie Behavior
The idea is that the cookie should write the referrer information on whatever page the user lands on. The include for writing the cookie is included on every page of the site and has a conditional wrapper that essentially says don't write the cookie if the cookie exists.

Thus should preserve the value of the first page the user lands on so that I can retrieve the information later. Unfortunately, sometimes the page written is not the first page of landing .. but rather the last page prior to the page that requests the cookie.

View Replies !
Strnge Function Behavior
I have a simple function (show.php) that resizes & displays images onto a page. Code:

View Replies !
Different Behavior Between Desktop And BlackBerry
I can't seem to figure this one out. On my site, I have a real estate listing form. One of the fields is for the user to be able to upload a picture.

Now, when I access this page on my PC at home, I have no problems. The error handling and security checks work fine. Regardless of whether I input info for this picture field, the form processor works. Code:

View Replies !
Strange Include() Behavior
I'm building a php site which uses axaj for navigation. it basically goes: Code:

View Replies !
Normal Behavior W/ Slashes
Before anything is inserted into my site's DB, I run addslashes() on it. When the function is used, data in the DB looks exactly like it did when it was submitted. For example, if a user enters O'Reilly in a form, it will appear as O'Reilly in the database (when viewed in phpmyadmin, at least.) This seems to negate the need for stripslashes() when displaying text from the database, as there are no slashes in the string.

View Replies !
$_SERVER['HTTP_REFERER'] Strange Behavior.
I'm having trouble with referring a page across my site.

My php uses a switch statement to see which action to use (if any):

if(!empty($action_get)) {
switch ($action_get) {
case 'student_unassign':
header('Location: ' . ERROR_FILE . '?error_id=2');
exit;
break;
default:
header('Location: ' . ERROR_FILE . '?error_id=2');
exit;
break;
}
}


These two cases produce different results on the error.php page (defined as a constant for ERROR_FILE)

I split out the referer array:

$ref = $_SERVER['HTTP_REFERER'];
$ref_arr = explode("/", $ref);
$ref_count = count($ref_arr);
$ref_url = $ref_arr[$ref_count-1];

and use $ref_url to display the referring page.

case 'student_unassign':

correctly displays where it's from (students.php)

default:

all the values are blank.

Any idea what is causing this / how to fix it?

Effectively I'm trying to positively validate the $action_get variable, and if it's not 'student_unassign', then redirect to the error.php page, creating a link for the user to return to the correct ("students.php") page.

View Replies !
Strange File Upload Behavior
I was having permission problems, so I'm using a test file to make
sure uploading works.

upload.php successfully uploads a file to the images/bookcovers dir:

<html>
<form method="post" enctype="multipart/form-data" action="upload.php">
<input type="file" name="userfile">
<input type="submit" value="submit">
<input type="text" name="eh" value='meh&lt;'>
</form>

<?php
$source = $_FILES['userfile']['tmp_name'];
$dest = 'images/bookcovers/' . $_FILES['userfile']['name'];
if ( ($source != 'none') && ($source != '' )) {
move_uploaded_file( $source, $dest );
}
?>

</html>

Now, I use the same code in another php file. The file is in the same
dir as the file above, and has the same permissions. The pertinent
code is:

$source = $_FILES['small_image']['tmp_name'];
if ( ($source != 'none') && ($source != '' )) {
$dest = explode(".", $_FILES['small_image']['name']);
$dest = './images/bookcovers/' . $isbn . "_small." . $dest[1];
move_uploaded_file( $source, $dest );
$smallimg = 1;
chmod($dest,0644);
}

When I try to upload a file using the second php script, I get
permission errors:

Warning: move_uploaded_file(./images/bookcovers/0679728759_small.jpg):
failed to open stream: No such file or directory in
/home/chucknet/public_html/bookclub/addBook.php on line 120

Warning: move_uploaded_file(): Unable to move '/tmp/phpw93I5U' to
'./images/bookcovers/0679728759_small.jpg' in
/home/chucknet/public_html/bookclub/addBook.php on line 120

I'm really at a loss as to what could be causing this. Both scripts
have the same permissions and the same owner.

View Replies !
DomDocument::loadHTML - Expected Behavior?
Quick question about DomDocument::loadHTML (http://www.php.net/manual/en/functio...t-loadhtml.php) Why does this not create a parse-tree? Code:

View Replies !
LOGIN USER SERVER BEHAVIOR
In dreamweaver mx 2004 I used LOG IN USER SERVER BEHAVIOR [USER AUTHENTICATION] to built a login page, well, how I define webpages under this coverage that a user can access after login or can not access[define other pages out of this login coverage or in another login coverage can not access by first] ?

View Replies !
OOP Mysql Result Strange Behavior
When i pass a mysql result to the constructor of a class and use that
resultset inside that class the original resultset outside the class gets
affected too. That is not right i think because my result inside my class is
private. Code:

View Replies !
Strange Behavior With Phpmyadmin And Innodb Tables
I recently converted all my existing MyISAM tables to InnoDB tables
through phpmyadmin. I noticed some strange behavior whenever I would
refresh the screen, as phpmyadmin would report different numbers for the
cardinality of the primary key (i.e. one minute it would say cardinality
388, then 244 on refresh, then something else), and it would report
different values for the number of rows when mousing over the table
names on the left menubar. This behavior only seems to exist on tables
with a "larger" number of rows, and by larger I only mean ~100 or more
rows (tables with fewer rows always report the correct number of rows).

Whenever I do a SELECT *, I get the correct number of rows returned, so
I know they are actually there.

View Replies !
Unexpected Behavior When Creating Xhtml Documents
The following has been posted before (2 years ago) but no response was
added. Therefor again, the following code for creating xhtml file:

<?php

error_reporting(6143);

$xmlns = "http://www.w3.org/1999/xhtml";
$lang = "en";

$xhtml_1_strict = new DomImplementation();

$dtd_xhtml_1_strict = $xhtml_1_strict->createDocumentType("html", "-//
W3C//DTD XHTML 1.0 Strict//EN", "http://www.w3.org/TR/xhtml1/DTD/
xhtml1-strict.dtd");

$xhtml_1_strict_document = $xhtml_1_strict->createDocument("", "",
$dtd_xhtml_1_strict);
$xhtml_1_strict_document->encoding = "UTF-8";
$xhtml_1_strict_document->standalone = "no";


View Replies !
Function Exhibits Bizarre Behavior In Windows XP
function getResponse() {
  $responseID = @fopen('php://stdin', 'r') or die('Cannot read from stdin');
   while (($response = @fgets($responseID, 1024)) !== false) {
     @fclose($responseID);
     return $response;
   }
}

This function works just fine if using CLI PHP in a Unix platform. But this same function is required to be used in an application that is housed within a Windows XP platform, and in that platform, this function seems to ignore user input and returns null every time.

Does anyone have any idea why this would specifically happen only in Windows XP using CLI PHP and nowhere else? Is there some issue involving XP's version of stdin?

View Replies !
Strange Behavior When Loading MySQLi Extension On Win32
I have come to love the ease of updating PHP, since getting used to
using it these past few years. Recently, however, when I upgraded from
PHP 5.1 to PHP 5.2.0 and again when moving to 5.2.1, I noticed strange
behavior when trying to load php_mysqli.dll. I am using Apache 2.2.3
on Windows XP Pro (32-bit). I use the php5apache2_2.dll to load PHP as
an Apache module. The PHPIniDir directive in httpd.conf points to the
correct directory. I also have the older php_mysql.dll extension
loaded simultaneously, which works fine. However, in phpinfo(), MySQLi
is nowhere to be found, and trying to use any mysqli functions or its
class will yield an error saying that they're undefined. In php.ini,
the extension_dir directive points to "C:php5ext".

As for the environment, I have my PHP install dir in the _System_ PATH
(it's been there for a long time): C:php5. When I install, I just
move new release into the php5 directory, so necessary DLLs for
extensions do not need to be moved, and older versions can be
overwritten for newer releases. In fact, mb_string, mcrypt, GD2, cURL,
php_mysql, and many other extensions load just fine. However, the only
way I can get MySQLi to load correctly is by moving libmysql.dll into
my C:WINDOWSsystem or C:WINDOWSsystem32 folders.

I simply can't understand why the problem lies only with MySQLi. Also,
when I restart Apache, there are no errors. The MySQLi extension
directive in php.ini is also uncommented, by the way. :-)

This has only started to happen since my past couple upgrades, so I'm
not sure exactly what to make of that.

View Replies !
Question About The Behavior Of String Associative Array Keys
I am trying to use an associative array to pass names and scores to a JPgraph but I believe I may misunderstand something about associative arrays. Say I have an array called $kidscores where:

$kidscores=(Johnny_Jones => 50, Sally_Smith => 100, Tommy_TheCat =>75)

When I pass the $kidscores variable to JPgraph, and try to....

PHP Code:

View Replies !
Strange Behavior Of Class: Lose Data On Throw Exception.
I use a class vith a vaiables.
When a function throws an exception it seems to loose data:

....
$c=new myclass();
try{
$a->var1=1;
$a->function_throw_exception(); <--- this throws an exception
...
}
catche(exception $e)
{
$a->var1; <--- is empty ?!?!
}

The code is more complex but the idea is this.
it is possible?
what do you think?

View Replies !
Using Fsockopen()
While using fsockopen(), to check a URL using:

$fp = fsockopen("$url", 80, $errno, $errstr, 30);
if (!$fp)
{
echo "<br>The Link (URL) could ot be validated<br>
<b>You entered: $url</b><p>
<a href="../auth/user_edit.php">Please try again</a><p>";
exit();
}
else
{
// then it was successful!
fclose($fp); // and carry on
}

It does the job as expected
My message is displayed but also the following warning:

Warning: fsockopen() [function.fsockopen]: unable to connect to http://www.asdfghjkl.com:80 (Unable to find the socket transport "http" - did you forget to enable it when you configured PHP?) in C:wampwwwaaaaaurllinkssubmit_url.php on line 106

The rest (my message) is fine and required:

View Replies !
Fsockopen()
All variables are defined and the 'else{ $sendbody = ... blah, blah, blah,.... mail(vars) } works. It only has problems when the mail server is a remote host or I am attempting to connect via IP rather than use the mail command. If the first section is correct I am connecting, just not finishing session ($text91 says unable to connect, blah, blah, blah, etc...). Code:

View Replies !
IIS Fsockopen
My code here accesses an IIS server and returns

HTTP/1.1 400 Bad Request Server: Microsoft-IIS/5.0 Date: Fri, 16 Apr 2004
10:36:56 GMT Content-Type: text/html Content-Length: 87 The parameter is
incorrect.

what am i doing wrong? does anyone know what a valid http post header for
IIS would look like?


<?php
$fp = fsockopen("www.suedtirol.info", 80, $errno, $errstr, 30);
if (!$fp)
{
echo "$errstr ($errno)<br />";
}
else
{
$out = "HEAD /XmlApi/Demo/SeekEngine.Get http/1.0";
$out .= "Host: www.suedtirol.info";
$out .= "Connection: Close";

fputs($fp, $out);
while (!feof($fp))
{
echo fgets($fp, 128);
}
fclose($fp);
}
//php fsockopen IIS error
?>

View Replies !
Fsockopen And SSL
I'm trying to open a socket to a web page that uses SSL. If I specify port 80 (obviously wrong, I know), I get an error stating that the page uses SSL, and that I should use https:// to specify the address. Of course, since I'm trying to open the page using fsockopen this doesn't help.

If I specify port 443 the script just times out. When I try the same script on a non-SSL page using port 80 it works great, so I know the basic script is ok. Is there any way to specify that you want to connect securely in the HTTP request header? I've been looking for info on this everywhere and haven't had any luck.

View Replies !
Fsockopen() Help
I'm trying to open, read and extract information from a website
(maximum and minimum temps from
http://www.bom.gov.au/cgi-bin/wrap_fwo.pl?IDV10450.txt )... Could
anyone give me some direction in how to do this? Below is the code I
have written but i keep get given an 'invalid stream resource' error

<?php

$page = "www.bom.gov.au/cgi-bin/wrap_fwo.pl?IDV10450.txt";
$time_limit = 60;
$file = fsockopen($page, $errno, $error, $time_limit);
if(!fp){
echo("Connection failure");
}
else
{
fputs($file, "GET / HTTP/1.0

");
while (!feof($file)){
$data[] = fgets($file, 1000);
}
fclose($file);
}
?>

View Replies !
Fsockopen Uses?
im interested in learning more about the fsockopen function, what are
some of the typical uses for this function?

View Replies !
PHP + Hi5 + Fsockopen
I need some ideias on this problem, it looks like this:

* I need to have a script that logs in hi5 with a given username/password [This one is already working]

* Then uploads pictures to the given username profile [??]

My doubt is, how can I keep the 2nd part of the script logged in so I can upload my picture? I need to do this with sockets, not using curl functions.

View Replies !
@fsockopen
here about time out settings.

@fsockopen ("IP", PORT, $errno, $errstr, .2)

Is the .2 a timeout length?  If so what are the limits on the value?  ex: .1 - .9 .

View Replies !
Should I Use Fsockopen Or Something Else?
Currently I am making a "tool" :) that will grab some websites source code and will search for a specified text (e.g. javascript codes) in it. I am using fsockopen function for connection to a website and it works great if the websites location is normal.

E.g. if the website starts at www.example.com then fsockopen works fine, but if the website uses auto-redirect(via Location header field) to www.example.com/en/ or www.example.com/login.php then it doesn work. It only shows the redirect pages headers.

Maybe you have some better ideas how to grab websites source code? I've heard that fopen is not working remotely with most servers..

View Replies !
Fsockopen
is there any way to test if fsockopen command is available to be used on my hosting server? my web hosts advise me that it is up and running (I had to pay extra to get a dedicated server to get the function) but im not too sure as I cannot connect to grab shoutcast stats using the function with a script i already have, which is my goal (I run a internet radio site), however if i upload exactly the same script to another server i use for another site to test it, it works without problem.

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved