Re: web sniffer

Re: web sniffer

am 18.03.2010 23:00:12 von Ashley Sheridan

--=-1TL4eeptynlknN3HI2PO
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Fri, 2010-03-19 at 00:03 +0200, madunix wrote:

> I've been trying to read the contents from a particular URL into a
> string in PHP, and can't get it to work. any help.
>
> Thanks
>
> --
> If there is a way, I will find one...***
> If there is none, I will make one..."***
> **************** madunix ******************
>


How have you been trying to do it so far?

There are a couple of ways. file_get_contents() and fopen() will work on
URL's if the right ports are open.

Most usually though cURL is used for this sort of thing.

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



--=-1TL4eeptynlknN3HI2PO--

web sniffer

am 18.03.2010 23:03:24 von madunix

I've been trying to read the contents from a particular URL into a
string in PHP, and can't get it to work. any help.

Thanks

--
If there is a way, I will find one...***
If there is none, I will make one..."***
**************** madunix ******************

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

Re: web sniffer

am 18.03.2010 23:08:55 von Adam Richardson

--001636c5a41614888704821a7a85
Content-Type: text/plain; charset=ISO-8859-1

On Thu, Mar 18, 2010 at 6:03 PM, madunix wrote:

> I've been trying to read the contents from a particular URL into a
> string in PHP, and can't get it to work. any help.
>
> Thanks
>
> --
> If there is a way, I will find one...***
> If there is none, I will make one..."***
> **************** madunix ******************
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
$markup = file_get_contents('http://domain.com');
?>

--
Nephtali: PHP web framework that functions beautifully
http://nephtaliproject.com

--001636c5a41614888704821a7a85--

Re: web sniffer

am 18.03.2010 23:08:57 von Ashley Sheridan

--=-DGpNier3KzmxXBXXiPzp
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Fri, 2010-03-19 at 00:11 +0200, madunix wrote:
> trying http://us3.php.net/manual/en/function.fsockopen.php
> do you a piece of code that read parts pages.
>
>
> On Fri, Mar 19, 2010 at 12:00 AM, Ashley Sheridan
> wrote:
>
>
> On Fri, 2010-03-19 at 00:03 +0200, madunix wrote:
>
> > I've been trying to read the contents from a particular URL into a
> > string in PHP, and can't get it to work. any help.
> >
> > Thanks
> >
> > --
> > If there is a way, I will find one...***
> > If there is none, I will make one..."***
> > **************** madunix ******************
> >
>
>
>
>
> How have you been trying to do it so far?
>
> There are a couple of ways. file_get_contents() and fopen()
> will work on URL's if the right ports are open.
>
> Most usually though cURL is used for this sort of thing.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
>
>
>
>
> --
> If there is a way, I will find one...***
> If there is none, I will make one..."***
> **************** madunix ******************
>
>

I think you're over-complicating things by using fsockopen(). Try one of
the functions I mentioned in my last email

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



--=-DGpNier3KzmxXBXXiPzp--

Re: web sniffer

am 18.03.2010 23:11:30 von madunix

--001636416b7951f3da04821a83fd
Content-Type: text/plain; charset=UTF-8

trying http://us3.php.net/manual/en/function.fsockopen.php
do you a piece of code that read parts pages.

On Fri, Mar 19, 2010 at 12:00 AM, Ashley Sheridan
wrote:

> On Fri, 2010-03-19 at 00:03 +0200, madunix wrote:
>
> I've been trying to read the contents from a particular URL into a
> string in PHP, and can't get it to work. any help.
>
> Thanks
>
> --
> If there is a way, I will find one...***
> If there is none, I will make one..."***
> **************** madunix ******************
>
>
>
> How have you been trying to do it so far?
>
> There are a couple of ways. file_get_contents() and fopen() will work on
> URL's if the right ports are open.
>
> Most usually though cURL is used for this sort of thing.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>


--
If there is a way, I will find one...***
If there is none, I will make one..."***
**************** madunix ******************

--001636416b7951f3da04821a83fd--

Re: web sniffer

am 18.03.2010 23:32:46 von Adam Richardson

--00151744790e58514f04821acf6e
Content-Type: text/plain; charset=ISO-8859-1

On Thu, Mar 18, 2010 at 6:08 PM, Ashley Sheridan
wrote:

> On Fri, 2010-03-19 at 00:11 +0200, madunix wrote:
> > trying http://us3.php.net/manual/en/function.fsockopen.php
> > do you a piece of code that read parts pages.
> >
> >
> > On Fri, Mar 19, 2010 at 12:00 AM, Ashley Sheridan
> > wrote:
> >
> >
> > On Fri, 2010-03-19 at 00:03 +0200, madunix wrote:
> >
> > > I've been trying to read the contents from a particular URL
> into a
> > > string in PHP, and can't get it to work. any help.
> > >
> > > Thanks
> > >
> > > --
> > > If there is a way, I will find one...***
> > > If there is none, I will make one..."***
> > > **************** madunix ******************
> > >
> >
> >
> >
> >
> > How have you been trying to do it so far?
> >
> > There are a couple of ways. file_get_contents() and fopen()
> > will work on URL's if the right ports are open.
> >
> > Most usually though cURL is used for this sort of thing.
> >
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> >
> >
> >
> >
> >
> >
> >
> > --
> > If there is a way, I will find one...***
> > If there is none, I will make one..."***
> > **************** madunix ******************
> >
> >
>
> I think you're over-complicating things by using fsockopen(). Try one of
> the functions I mentioned in my last email
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
I agree with Ashley, use one of the other options and then parse the
response to get the part of the page you'd like to work with.

--
Nephtali: PHP web framework that functions beautifully
http://nephtaliproject.com

--00151744790e58514f04821acf6e--

Re: web sniffer

am 18.03.2010 23:55:11 von madunix

okay ..it works now i use
$data=3Dfile_get_contents("http://www.my.com");
echo $data;
?>

On Fri, Mar 19, 2010 at 12:32 AM, Adam Richardson wr=
ote:
> On Thu, Mar 18, 2010 at 6:08 PM, Ashley Sheridan k>
> wrote:
>>
>> On Fri, 2010-03-19 at 00:11 +0200, madunix wrote:
>> > trying http://us3.php.net/manual/en/function.fsockopen.php
>> > do you a piece of code that  read parts  pages.
>> >
>> >
>> > On Fri, Mar 19, 2010 at 12:00 AM, Ashley Sheridan
>> > wrote:
>> >
>> >
>> >         On Fri, 2010-03-19 at 00:03 +0200, madunix=
wrote:
>> >
>> >         > I've been trying to read the contents fr=
om a particular URL
>> > into a
>> >         > string in PHP, and can't get it to work.=
 any help.
>> >         >
>> >         > Thanks
>> >         >
>> >         > --
>> >         > If there is a way, I will find one...***
>> >         > If there is none, I will make one..."***
>> >         > **************** madunix  *********=
*********
>> >         >
>> >
>> >
>> >
>> >
>> >         How have you been trying to do it so far?
>> >
>> >         There are a couple of ways. file_get_conte=
nts() and fopen()
>> >         will work on URL's if the right ports are =
open.
>> >
>> >         Most usually though cURL is used for this =
sort of thing.
>> >
>> >         Thanks,
>> >         Ash
>> >         http://www.ashleysheridan.co.uk
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > --
>> > If there is a way, I will find one...***
>> > If there is none, I will make one..."***
>> > **************** madunix  ******************
>> >
>> >
>>
>> I think you're over-complicating things by using fsockopen(). Try one of
>> the functions I mentioned in my last email
>>
>> Thanks,
>> Ash
>> http://www.ashleysheridan.co.uk
>>
>>
>
> I agree with Ashley, use one of the other options and then parse the
> response to get the part of the page you'd like to work with.
>
> --
> Nephtali:  PHP web framework that functions beautifully
> http://nephtaliproject.com
>



--=20
If there is a way, I will find one...***
If there is none, I will make one..."***
**************** madunix ******************

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

Re: web sniffer

am 19.03.2010 08:53:40 von jochen schultz

Btw., when you use file_get_contets, is there a good way to tell the
script to stop recieving the file after let's say 2 seconds - just in
case the server is not reachable - to avoid using fsockopen?

regards
Jochen

madunix schrieb:
> okay ..it works now i use
> > $data=file_get_contents("http://www.my.com");
> echo $data;
> ?>
>
> On Fri, Mar 19, 2010 at 12:32 AM, Adam Richardson wrote:
>> On Thu, Mar 18, 2010 at 6:08 PM, Ashley Sheridan
>> wrote:
>>> On Fri, 2010-03-19 at 00:11 +0200, madunix wrote:
>>>> trying http://us3.php.net/manual/en/function.fsockopen.php
>>>> do you a piece of code that read parts pages.
>>>>
>>>>
>>>> On Fri, Mar 19, 2010 at 12:00 AM, Ashley Sheridan
>>>> wrote:
>>>>
>>>>
>>>> On Fri, 2010-03-19 at 00:03 +0200, madunix wrote:
>>>>
>>>> > I've been trying to read the contents from a particular URL
>>>> into a
>>>> > string in PHP, and can't get it to work. any help.
>>>> >
>>>> > Thanks
>>>> >
>>>> > --
>>>> > If there is a way, I will find one...***
>>>> > If there is none, I will make one..."***
>>>> > **************** madunix ******************
>>>> >
>>>>
>>>>
>>>>
>>>>
>>>> How have you been trying to do it so far?
>>>>
>>>> There are a couple of ways. file_get_contents() and fopen()
>>>> will work on URL's if the right ports are open.
>>>>
>>>> Most usually though cURL is used for this sort of thing.
>>>>
>>>> Thanks,
>>>> Ash
>>>> http://www.ashleysheridan.co.uk
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> If there is a way, I will find one...***
>>>> If there is none, I will make one..."***
>>>> **************** madunix ******************
>>>>
>>>>
>>> I think you're over-complicating things by using fsockopen(). Try one of
>>> the functions I mentioned in my last email
>>>
>>> Thanks,
>>> Ash
>>> http://www.ashleysheridan.co.uk
>>>
>>>
>> I agree with Ashley, use one of the other options and then parse the
>> response to get the part of the page you'd like to work with.
>>
>> --
>> Nephtali: PHP web framework that functions beautifully
>> http://nephtaliproject.com
>>
>
>
>

--
Sport Import GmbH - Amtsgericht Oldenburg - Tel: +49-4405-9280-63
Industriestrasse 39 - HRB 1202900 -
26188 Edewecht - GF: Michael Müllmann

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

Re: web sniffer

am 19.03.2010 09:16:23 von Peter Lind

You should be able to do that by setting context options:
http://www.php.net/manual/en/context.http.php

On 19 March 2010 08:53, Jochen Schultz wrote:
> Btw., when you use file_get_contets, is there a good way to tell the scri=
pt
> to stop recieving the file after let's say 2 seconds - just in case the
> server is not reachable - to avoid using fsockopen?
>
> regards
> Jochen
>
> madunix schrieb:
>>
>> okay ..it works now i use
>> >> $data=3Dfile_get_contents("http://www.my.com");
>> echo $data;
>> ?>
>>
>> On Fri, Mar 19, 2010 at 12:32 AM, Adam Richardson
>> wrote:
>>>
>>> On Thu, Mar 18, 2010 at 6:08 PM, Ashley Sheridan
>>>
>>> wrote:
>>>>
>>>> On Fri, 2010-03-19 at 00:11 +0200, madunix wrote:
>>>>>
>>>>> trying http://us3.php.net/manual/en/function.fsockopen.php
>>>>> do you a piece of code that  read parts  pages.
>>>>>
>>>>>
>>>>> On Fri, Mar 19, 2010 at 12:00 AM, Ashley Sheridan
>>>>> wrote:
>>>>>
>>>>>
>>>>>        On Fri, 2010-03-19 at 00:03 +0200, madunix=
wrote:
>>>>>
>>>>>        > I've been trying to read the contents fr=
om a particular URL
>>>>> into a
>>>>>        > string in PHP, and can't get it to work.=
 any help.
>>>>>        >
>>>>>        > Thanks
>>>>>        >
>>>>>        > --
>>>>>        > If there is a way, I will find one...***
>>>>>        > If there is none, I will make one..."***
>>>>>        > **************** madunix  *********=
*********
>>>>>        >
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>        How have you been trying to do it so far?
>>>>>
>>>>>        There are a couple of ways. file_get_conte=
nts() and fopen()
>>>>>        will work on URL's if the right ports are =
open.
>>>>>
>>>>>        Most usually though cURL is used for this =
sort of thing.
>>>>>
>>>>>        Thanks,
>>>>>        Ash
>>>>>        http://www.ashleysheridan.co.uk
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> If there is a way, I will find one...***
>>>>> If there is none, I will make one..."***
>>>>> **************** madunix  ******************
>>>>>
>>>>>
>>>> I think you're over-complicating things by using fsockopen(). Try one =
of
>>>> the functions I mentioned in my last email
>>>>
>>>> Thanks,
>>>> Ash
>>>> http://www.ashleysheridan.co.uk
>>>>
>>>>
>>> I agree with Ashley, use one of the other options and then parse the
>>> response to get the part of the page you'd like to work with.
>>>
>>> --
>>> Nephtali:  PHP web framework that functions beautifully
>>> http://nephtaliproject.com
>>>
>>
>>
>>
>
> --
>  Sport Import GmbH   - Amtsgericht Oldenburg  - Tel: =C2=
=A0 +49-4405-9280-63
>  Industriestrasse 39 - HRB 1202900         =C2=
=A0  -
>  26188 Edewecht      - GF: Michael Müllmann
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



--=20

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51


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

Re: web sniffer

am 19.03.2010 09:46:21 von madunix

can any one give a complete sample script how to retrieve data content
from web (jpg, pdf, field).

Thanks

On Fri, Mar 19, 2010 at 9:53 AM, Jochen Schultz w=
rote:
> Btw., when you use file_get_contets, is there a good way to tell the scri=
pt
> to stop recieving the file after let's say 2 seconds - just in case the
> server is not reachable - to avoid using fsockopen?
>
> regards
> Jochen
>
> madunix schrieb:
>>
>> okay ..it works now i use
>> >> $data=3Dfile_get_contents("http://www.my.com");
>> echo $data;
>> ?>
>>
>> On Fri, Mar 19, 2010 at 12:32 AM, Adam Richardson
>> wrote:
>>>
>>> On Thu, Mar 18, 2010 at 6:08 PM, Ashley Sheridan
>>>
>>> wrote:
>>>>
>>>> On Fri, 2010-03-19 at 00:11 +0200, madunix wrote:
>>>>>
>>>>> trying http://us3.php.net/manual/en/function.fsockopen.php
>>>>> do you a piece of code that  read parts  pages.
>>>>>
>>>>>
>>>>> On Fri, Mar 19, 2010 at 12:00 AM, Ashley Sheridan
>>>>> wrote:
>>>>>
>>>>>
>>>>>        On Fri, 2010-03-19 at 00:03 +0200, madunix=
wrote:
>>>>>
>>>>>        > I've been trying to read the contents fr=
om a particular URL
>>>>> into a
>>>>>        > string in PHP, and can't get it to work.=
 any help.
>>>>>        >
>>>>>        > Thanks
>>>>>        >
>>>>>        > --
>>>>>        > If there is a way, I will find one...***
>>>>>        > If there is none, I will make one..."***
>>>>>        > **************** madunix  *********=
*********
>>>>>        >
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>        How have you been trying to do it so far?
>>>>>
>>>>>        There are a couple of ways. file_get_conte=
nts() and fopen()
>>>>>        will work on URL's if the right ports are =
open.
>>>>>
>>>>>        Most usually though cURL is used for this =
sort of thing.
>>>>>
>>>>>        Thanks,
>>>>>        Ash
>>>>>        http://www.ashleysheridan.co.uk
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> If there is a way, I will find one...***
>>>>> If there is none, I will make one..."***
>>>>> **************** madunix  ******************
>>>>>
>>>>>
>>>> I think you're over-complicating things by using fsockopen(). Try one =
of
>>>> the functions I mentioned in my last email
>>>>
>>>> Thanks,
>>>> Ash
>>>> http://www.ashleysheridan.co.uk
>>>>
>>>>
>>> I agree with Ashley, use one of the other options and then parse the
>>> response to get the part of the page you'd like to work with.
>>>
>>> --
>>> Nephtali:  PHP web framework that functions beautifully
>>> http://nephtaliproject.com
>>>
>>
>>
>>
>
> --
>  Sport Import GmbH   - Amtsgericht Oldenburg  - Tel: =C2=
=A0 +49-4405-9280-63
>  Industriestrasse 39 - HRB 1202900         =C2=
=A0  -
>  26188 Edewecht      - GF: Michael Müllmann
>



--=20
If there is a way, I will find one...***
If there is none, I will make one..."***
**************** madunix ******************

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

RE: web sniffer

am 19.03.2010 12:24:29 von Ashley Sheridan

--=-o2IREQOdrBzcNqfVkh48
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Fri, 2010-03-19 at 06:25 -0500, Jay Blanchard wrote:

> [snip]
> can any one give a complete sample script how to retrieve data content
> from web (jpg, pdf, field).
> [/snip]
>
> Your question is a little too far reaching. You can use string functions
> match portions of strings including tried and true regular expressions.
>
> What do you want to do, specifically?


I assume he wants to retrieve the files for a page as well.

I'd recommend having PHP call wget on the shell, as that tool was built
for this sort of thing.

If you don't have access to wget, then you could use some sort of DOM or
string manipulation to find out what files are used in a web page and
then make separate requests via cURL to grab those, as
file_get_contents() might not be totally reliable for this sort of
thing.

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



--=-o2IREQOdrBzcNqfVkh48--

RE: web sniffer

am 19.03.2010 12:25:01 von Jay Blanchard

[snip]
can any one give a complete sample script how to retrieve data content
from web (jpg, pdf, field).
[/snip]

Your question is a little too far reaching. You can use string functions
match portions of strings including tried and true regular expressions.

What do you want to do, specifically?

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

Re: web sniffer

am 19.03.2010 12:59:29 von jochen schultz

Maybe this code may help you getting into it?


class simpleHttpSocket {

public function
sendHttpRequest($host,$filename,$port=80,$timeout=1,$x=0,$re sult=array()) {
$header = 'GET /'.$filename.' HTTP/1.1'.PHP_EOL;
$header .= 'Host: '.$host.PHP_EOL;
$header .= 'Connection: close'.PHP_EOL;
$header .= 'User-Agent: Simple(php-general@lists.php.net)'.PHP_EOL;
$header .= "Referer: http://test-server.tld/".PHP_EOL.PHP_EOL;
$socket=@fsockopen($host, $port, &$errno, &$errstr, $timeout);
$result[-1]='';
if (!$socket){
trigger_error('Connection timeout',E_USER_NOTICE);
$result["errno"] = $errno;
$result["errstr"] = $errstr;
return $result;
}
fputs($socket, $header);
while (!feof($socket)) {
$result[$x++] = fgets($socket, 128);
if (preg_match('/^Location:/',$result[$x-1])) {
return $result[$x-1];
}
flush();
}
return $result;
}
}

$post = new simpleHttpSocket;
$host = 'www.example.com';
$filename = ''; // leave empty for index file or else:
// $filename = 'image.jpg';
$file = $post->sendHttpRequest($host,$header,80,2);

// Output
while(list($k,$v)=each($file)) {
echo $v.'
';
}

?>

regards
Jochen

madunix schrieb:
> can any one give a complete sample script how to retrieve data content
> from web (jpg, pdf, field).
>
> Thanks
>
> On Fri, Mar 19, 2010 at 9:53 AM, Jochen Schultz wrote:
>> Btw., when you use file_get_contets, is there a good way to tell the script
>> to stop recieving the file after let's say 2 seconds - just in case the
>> server is not reachable - to avoid using fsockopen?
>>
>> regards
>> Jochen
>>
>> madunix schrieb:
>>> okay ..it works now i use
>>> >>> $data=file_get_contents("http://www.my.com");
>>> echo $data;
>>> ?>
>>>
>>> On Fri, Mar 19, 2010 at 12:32 AM, Adam Richardson
>>> wrote:
>>>> On Thu, Mar 18, 2010 at 6:08 PM, Ashley Sheridan
>>>>
>>>> wrote:
>>>>> On Fri, 2010-03-19 at 00:11 +0200, madunix wrote:
>>>>>> trying http://us3.php.net/manual/en/function.fsockopen.php
>>>>>> do you a piece of code that read parts pages.
>>>>>>
>>>>>>
>>>>>> On Fri, Mar 19, 2010 at 12:00 AM, Ashley Sheridan
>>>>>> wrote:
>>>>>>
>>>>>>
>>>>>> On Fri, 2010-03-19 at 00:03 +0200, madunix wrote:
>>>>>>
>>>>>> > I've been trying to read the contents from a particular URL
>>>>>> into a
>>>>>> > string in PHP, and can't get it to work. any help.
>>>>>> >
>>>>>> > Thanks
>>>>>> >
>>>>>> > --
>>>>>> > If there is a way, I will find one...***
>>>>>> > If there is none, I will make one..."***
>>>>>> > **************** madunix ******************
>>>>>> >
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> How have you been trying to do it so far?
>>>>>>
>>>>>> There are a couple of ways. file_get_contents() and fopen()
>>>>>> will work on URL's if the right ports are open.
>>>>>>
>>>>>> Most usually though cURL is used for this sort of thing.
>>>>>>
>>>>>> Thanks,
>>>>>> Ash
>>>>>> http://www.ashleysheridan.co.uk
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> If there is a way, I will find one...***
>>>>>> If there is none, I will make one..."***
>>>>>> **************** madunix ******************
>>>>>>
>>>>>>
>>>>> I think you're over-complicating things by using fsockopen(). Try one of
>>>>> the functions I mentioned in my last email
>>>>>
>>>>> Thanks,
>>>>> Ash
>>>>> http://www.ashleysheridan.co.uk
>>>>>
>>>>>
>>>> I agree with Ashley, use one of the other options and then parse the
>>>> response to get the part of the page you'd like to work with.
>>>>
>>>> --
>>>> Nephtali: PHP web framework that functions beautifully
>>>> http://nephtaliproject.com
>>>>
>>>
>>>
>> --
>> Sport Import GmbH - Amtsgericht Oldenburg - Tel: +49-4405-9280-63
>> Industriestrasse 39 - HRB 1202900 -
>> 26188 Edewecht - GF: Michael Müllmann
>>
>
>
>

--
Sport Import GmbH - Amtsgericht Oldenburg - Tel: +49-4405-9280-63
Industriestrasse 39 - HRB 1202900 -
26188 Edewecht - GF: Michael Müllmann

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

Re: web sniffer

am 19.03.2010 13:03:56 von jochen schultz

Thanks alot!

regards
Jochen

Peter Lind schrieb:
> You should be able to do that by setting context options:
> http://www.php.net/manual/en/context.http.php
>
> On 19 March 2010 08:53, Jochen Schultz wrote:
>> Btw., when you use file_get_contets, is there a good way to tell the script
>> to stop recieving the file after let's say 2 seconds - just in case the
>> server is not reachable - to avoid using fsockopen?
>>
>> regards
>> Jochen
>>
>> madunix schrieb:
>>> okay ..it works now i use
>>> >>> $data=file_get_contents("http://www.my.com");
>>> echo $data;
>>> ?>
>>>
>>> On Fri, Mar 19, 2010 at 12:32 AM, Adam Richardson
>>> wrote:
>>>> On Thu, Mar 18, 2010 at 6:08 PM, Ashley Sheridan
>>>>
>>>> wrote:
>>>>> On Fri, 2010-03-19 at 00:11 +0200, madunix wrote:
>>>>>> trying http://us3.php.net/manual/en/function.fsockopen.php
>>>>>> do you a piece of code that read parts pages.
>>>>>>
>>>>>>
>>>>>> On Fri, Mar 19, 2010 at 12:00 AM, Ashley Sheridan
>>>>>> wrote:
>>>>>>
>>>>>>
>>>>>> On Fri, 2010-03-19 at 00:03 +0200, madunix wrote:
>>>>>>
>>>>>> > I've been trying to read the contents from a particular URL
>>>>>> into a
>>>>>> > string in PHP, and can't get it to work. any help.
>>>>>> >
>>>>>> > Thanks
>>>>>> >
>>>>>> > --
>>>>>> > If there is a way, I will find one...***
>>>>>> > If there is none, I will make one..."***
>>>>>> > **************** madunix ******************
>>>>>> >
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> How have you been trying to do it so far?
>>>>>>
>>>>>> There are a couple of ways. file_get_contents() and fopen()
>>>>>> will work on URL's if the right ports are open.
>>>>>>
>>>>>> Most usually though cURL is used for this sort of thing.
>>>>>>
>>>>>> Thanks,
>>>>>> Ash
>>>>>> http://www.ashleysheridan.co.uk
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> If there is a way, I will find one...***
>>>>>> If there is none, I will make one..."***
>>>>>> **************** madunix ******************
>>>>>>
>>>>>>
>>>>> I think you're over-complicating things by using fsockopen(). Try one of
>>>>> the functions I mentioned in my last email
>>>>>
>>>>> Thanks,
>>>>> Ash
>>>>> http://www.ashleysheridan.co.uk
>>>>>
>>>>>
>>>> I agree with Ashley, use one of the other options and then parse the
>>>> response to get the part of the page you'd like to work with.
>>>>
>>>> --
>>>> Nephtali: PHP web framework that functions beautifully
>>>> http://nephtaliproject.com
>>>>
>>>
>>>
>> --
>> Sport Import GmbH - Amtsgericht Oldenburg - Tel: +49-4405-9280-63
>> Industriestrasse 39 - HRB 1202900 -
>> 26188 Edewecht - GF: Michael Müllmann
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
>

--
Sport Import GmbH - Amtsgericht Oldenburg - Tel: +49-4405-9280-63
Industriestrasse 39 - HRB 1202900 -
26188 Edewecht - GF: Michael Müllmann

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

Re: web sniffer

am 19.03.2010 13:40:24 von Rene Veerman

"field"?

On Fri, Mar 19, 2010 at 9:46 AM, madunix wrote:
> can any one give a complete sample script how to retrieve data content
> from web (jpg, pdf, field).
>

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

Re: web sniffer

am 22.03.2010 13:16:41 von Auke van Slooten

Jochen Schultz wrote:
> Btw., when you use file_get_contets, is there a good way to tell the
> script to stop recieving the file after let's say 2 seconds - just in
> case the server is not reachable - to avoid using fsockopen?

http://nl.php.net/manual/en/context.http.php

specifically:

timeout float
Read timeout in seconds, specified by a float (e.g. 10.5).
By default the default_socket_timeout php.ini setting is used.

used with http://nl.php.net/manual/en/function.stream-context-create.p hp

regards,
Auke van Slooten
Muze

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