Hello.
when i try to "read" some websites with fopen() some of them allow but
some don't
Does the server knows that it´s not a web browser that it's trying to
access?
How can i solve this??
Below is an example of a site that gives an error when you try to read
it.
<?php
$file="http://www.radios.pt/portalradio/";
$fp = fopen($file, "r");
while (!feof($fp))
{
$a=$a.fgets($fp );
}
fclose($fp);
echo $a;
?> 6 6446
Hi,
You can adjust the User-Agent header like so:
ini_set('user_a gent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.8.1.10) Gecko/20071115 Firefox/2.0.0.10');
Then fetch a page:
$doc = file_get_conten ts('http://example.net');
If you want to implement a mirror, you can use mod_proxy and
mod_proxy_html. For example:
ProxyPass /my/mirror/ http://example.net/
If you want to store locally a page and associated images and scripts,
you can use wget with the -p option:
wget -p http://example.net
On Nov 30, 6:01 am, zenner <pro.ra...@hotm ail.comwrote:
Hello.
when i try to "read" some websites with fopen() some of them allow but
some don't
Does the server knows that it´s not a web browser that it's trying to
access?
How can i solve this??
Below is an example of a site that gives an error when you try to read
it.
<?php
$file="http://www.radios.pt/portalradio/";
$fp = fopen($file, "r");
while (!feof($fp))
{
$a=$a.fgets($fp );}
fclose($fp);
echo $a;
?>
zenner wrote:
Hello.
when i try to "read" some websites with fopen() some of them allow but
some don't
Does the server knows that it´s not a web browser that it's trying to
access?
How can i solve this??
Below is an example of a site that gives an error when you try to read
it.
<?php
$file="http://www.radios.pt/portalradio/";
$fp = fopen($file, "r");
while (!feof($fp))
{
$a=$a.fgets($fp );
}
fclose($fp);
echo $a;
?>
They could be checking the headers for the user agent. Like anything
sent by the client, however, it's not very reliable.
Usually when they do such things it's because they don't want people
accessing their site from scripts.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attgl obal.net
=============== ===
zenner wrote:
Hello.
when i try to "read" some websites with fopen() some of them allow but
some don't
Does the server knows that it´s not a web browser that it's trying to
access?
How can i solve this??
Below is an example of a site that gives an error when you try to read
it.
<?php
$file="http://www.radios.pt/portalradio/";
$fp = fopen($file, "r");
while (!feof($fp))
{
$a=$a.fgets($fp );
}
fclose($fp);
echo $a;
?>
Use curl.
Read a website with Fopen()
You don't want to do that as it will not work in a sane php setup
(allow_url_fope n should be disabled).
Use fsockopen and the HTTP Protocol manually or use a class like Pears HTTP.
On Fri, 30 Nov 2007 14:01:24 +0100, Jonas Werres <jo***@example. orgwrote:
>Read a website with Fopen()
You don't want to do that as it will not work in a sane php setup
(allow_url_fope n should be disabled).
Curious: why should it be?
--
Rik Wasmus
$handle = fopen("http://www.radios.pt/portalradio/", "rb");
$contents = '';
while (!feof($handle) )
{$contents .= fread($handle, 8192);}
fclose($handle) ;
$filename="cont ent.txt"; $fp=fopen($file name,"w"); fwrite ($fp,
$contents); fclose($fp);
I havent tried the above - its just a code snippet i have .
<comp.lang.ph p>
<zenner>
<Fri, 30 Nov 2007 03:01:58 -0800 (PST)>
<bc************ *************** *******@y5g2000 hsf.googlegroup s.com>
Below is an example of a site that gives an error when you try to read
it.
<?php
$file="http://www.radios.pt/portalradio/";
$fp = fopen($file, "r");
while (!feof($fp))
{
$a=$a.fgets($fp );
}
fclose($fp);
echo $a;
?> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: typingcat |
last post by:
Is it possible to read another web page in PHP?
If is ASP.NET, the code would be
------------
WebRequest req=WebRequest.Create("http://www.microsoft.com");
WebResponse res=req.GetResponse();
StreamReader sr = new StreamReader(res.GetResponseStream());
String Output=sr.ReadToEnd();
Response.Write("The content is : " + Output);
--------
|
by: Magix |
last post by:
Hi,
I have these string data: str_data1, str_data2, str_data3, which capture
some value after a routine process A. Then I would like to write (append)
these 3 string values into a text file each time after routine process A,
the text file is named "mytext.dat" in following format with "#####" as
separator.
The maximum entries of them is 5. When reaching the fifth entry, it will
delete the very first entry.
|
by: Patrice Kadionik |
last post by:
Hi all,
I want to make a brief comparison between read() and fread() (under a
Linux OS).
1. Family read and Co: open, close, read, write, ioctl...
2. Family fread and Co: fopen, fclose, fread, swrite, fcntl...
Family read and Co:
|
by: a |
last post by:
I have a struct to write to a file
struct _structA{
long x;
int y;
float z;
}
struct _structA A;
//file open
write(fd,A,sizeof(_structA));
//file close
|
by: fazulu deen |
last post by:
Hi all,
I have to read two text file(opcode,jump)...
I guess the following statements are correct(but it is not reading
the data
from that files and also not checking the presence of the files,why
so??)
unsigned h, i=0;
| |
by: asit dhal |
last post by:
hello friends,
can anyone explain me how to use read() write() function in C.
and also how to read a file from disk and show it on the monitor using
onlu read(), write() function ??????
|
by: Mague |
last post by:
I have got a website with a few friends from school(year8). We have got a website up. I want it so it looks for a textfile and reads and writes it into a textbox. It does do this. The only problem is that it doesn't read the whole file. It may read like 3 words out of 7 so its not that gud.
This is my code
<div id="text2" style="position:absolute; overflow:hidden; left:351px; top:192px; width:475px; height:671px; z-index:2"><div...
|
by: chazzy69 |
last post by:
The error :
http://www.somesite.com
Warning: fopen() : php_network_getaddresses: getaddrinfo failed: Name or service not known in /etc/etc/etc/etc/test.php on line 766
Warning: fopen(http://www.somesite.com) : failed to open stream: Success in /home/etc/etc/etc/etc/test.php on line 766
Unable to open file!
I cant actually figure out what the error is reffering to???
|
by: rohit |
last post by:
Hi All,
I am new to C language.I want to read integers from a text file and
want to do some operation in the main program.To be more specific I
need to multiply each of these integers with another set of integers
stored in an array.It would be a great help if you could provide some
code for it.I tried the function fscanf but by that I am able to read
only the first integer of the text file.Please help me.
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |