473,396 Members | 1,938 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.

fopen() problem

Hi,

Can anyone tell me why going to
http://www.algaebase.org/Distributio...5040XVy1A0A54A
yields results, while the same page retrieved with fopen() says 'no
results'?

<?php
$pageurl='http://www.algaebase.org/DistributionResponse.lasso?currentMethod=distro&sk =20&-session=abv3:D5C1E5F111d2e05040XVy1A0A54A';
$exthandle = fopen($pageurl, "r");
$content = file($pageurl);
fclose($exthandle);
echo(implode("",$content));
?>

Thanks
Piet

Jul 31 '06 #1
5 1810
pi************@gmail.com wrote:
Hi,

Can anyone tell me why going to
http://www.algaebase.org/Distributio...5040XVy1A0A54A
yields results, while the same page retrieved with fopen() says 'no
results'?

<?php
$pageurl='http://www.algaebase.org/DistributionResponse.lasso?currentMethod=distro&sk =20&-session=abv3:D5C1E5F111d2e05040XVy1A0A54A';
$exthandle = fopen($pageurl, "r");
$content = file($pageurl);
fclose($exthandle);
echo(implode("",$content));
?>

Thanks
Piet
Hi,

Open the same URL with Wget or something similar.
That way you can see the response.
Maybe it is redirecting?

Regards,
Erwin Moller
Jul 31 '06 #2
pi************@gmail.com wrote:
Hi,

Can anyone tell me why going to
http://www.algaebase.org/Distributio...5040XVy1A0A54A
yields results, while the same page retrieved with fopen() says 'no
results'?

<?php
$pageurl='http://www.algaebase.org/DistributionResponse.lasso?currentMethod=distro&sk =20&-session=abv3:D5C1E5F111d2e05040XVy1A0A54A';
$exthandle = fopen($pageurl, "r");
$content = file($pageurl);
fclose($exthandle);
echo(implode("",$content));
?>

Thanks
Piet
The first one gives me no results, either.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jul 31 '06 #3
pi************@gmail.com wrote:
Hi,

Can anyone tell me why going to
http://www.algaebase.org/Distributio...5040XVy1A0A54A
yields results, while the same page retrieved with fopen() says 'no
results'?

<?php
$pageurl='http://www.algaebase.org/DistributionResponse.lasso?currentMethod=distro&sk =20&-session=abv3:D5C1E5F111d2e05040XVy1A0A54A';
$exthandle = fopen($pageurl, "r");
$content = file($pageurl);
fclose($exthandle);
echo(implode("",$content));
?>

Thanks
Piet
This works when the session is fresh:

<?php

$pageurl='http://www.algaebase.org/DistributionResponse.lasso?currentMethod=distro&sk =0&-session=abv3:8008664A11d922E7E0QsT317D415';
echo file_get_contents($pageurl);

?>

Why are you using fopen() and file() and the same time?

Jul 31 '06 #4

Chung Leong wrote:
pi************@gmail.com wrote:
Hi,

Can anyone tell me why going to
http://www.algaebase.org/Distributio...5040XVy1A0A54A
yields results, while the same page retrieved with fopen() says 'no
results'?

<?php
$pageurl='http://www.algaebase.org/DistributionResponse.lasso?currentMethod=distro&sk =20&-session=abv3:D5C1E5F111d2e05040XVy1A0A54A';
$exthandle = fopen($pageurl, "r");
$content = file($pageurl);
fclose($exthandle);
echo(implode("",$content));
?>

Thanks
Piet

This works when the session is fresh:

<?php

$pageurl='http://www.algaebase.org/DistributionResponse.lasso?currentMethod=distro&sk =0&-session=abv3:8008664A11d922E7E0QsT317D415';
echo file_get_contents($pageurl);

?>

Why are you using fopen() and file() and the same time?
The code is a bit messy indeed, sorry for that. However, this worked
very fine before without ever changing the session name...

Jul 31 '06 #5
"pi************@gmail.com" <pi************@gmail.comwrote:
Can anyone tell me why going to
http://www.algaebase.org/Distributio...d=distro&sk=20
&-session=abv3:D5C1E5F111d2e05040XVy1A0A54A
yields results, while the same page retrieved with fopen() says 'no
results'?
That URL doesn't contain your search terms.

It contains a reference ("abv3:D5C1E5F111d2e05040XVy1A0A54A") to a
session stored on the server's hard drive which in turn holds your
search terms.

That session has a finite lifespan, and after that (maybe half an hour
or so) the server throws it away, and the URL becomes invalid.

If you want this to work and you do not control the algaebase server,
you are going to have to use curl to build a form submission and collect
the results. You cannot, to my knowledge do this with fopen(). You could
do your own HTTP transaction with fsockopen() et al but that would be
overkill.

miguel
--
Photos from 40 countries on 5 continents: http://travel.u.nu
Latest photos: Malaysia; Thailand; Singapore; Spain; Morocco
Airports of the world: http://airport.u.nu
Jul 31 '06 #6

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

Similar topics

11
by: Tesla | last post by:
hey guys, i use Fopen to get the contents from a web page, but I get this error... Warning: fopen(http://seb.sleepbot.com:8000/played.html): failed to open stream: HTTP request failed! ICY 400...
7
by: git_cs | last post by:
Hey, guys and gals Somedays ago, I had asked for the DES algorithm in C language. Although I have written the algorthim in C myself, I am facing a peculiar problem, which I hope some of u guys and...
3
by: Patrice | last post by:
Hi, I would to call fopen function several time in my application. This application permits to read files which path is registered in a configuration file. For exemple: File 1 = toto.txt File 2...
19
by: lihua | last post by:
Hi, Group! I got one question here: We all know that fclose() must be called after file operations to avoid unexpected errors.But there are really cases when you forget to do that!Just like...
10
by: pjlsr | last post by:
It's close to twenty years since I used the C language and at that time I was doing only floating point computational work, nothing with strings or reading files. I tried to use fopen in the...
2
by: Mike | last post by:
Hello, Im doing this in php5, apache Im not sure where the problem lies but I have a file <?php Class CreateXML{ public function xmlDeclaration(){ return $varxmlDec = "<?xml version='1.0'> ";...
4
by: peter.hrdy | last post by:
Hi guys. i have big problem with using fopen, fsockopen or curl. if i tried to use it on remote site it doesn't works. i've readed to much posts but didn't found anything helpfulll. fopen just...
16
by: Hans Fredrik Nordhaug | last post by:
I'm trying to write to a file in the current directory - no remote files. The subject says it all - I can add that both the directory and the file is wordwritable. This happens on a (quite good)...
3
by: IamtheEvster | last post by:
Hi there, I'm using fopen for the first time and I know I'm running into a permissions problem, but I can't seem to resolve it and any help would be greatly appreciated. I'm running PHP5 and...
4
by: Michel Rouzic | last post by:
I made a program that accepts as parameters an input file name that we'll call file1, and an output file name that we'll call file2, and opens on its own a configuration file called file3. My...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.