curl - html/1.0

Hey,

I have to following code

curl_setopt($ch, CURLOPT_URL,
"http://collect.myspace.com/index.cfm?fuseaction=invite.addf riend_verify&friendID="
.. $fid);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
curl_setopt($ch, CURLOPT_HTTPHEADER, $header_myspace_home);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
$pagecontents = curl_exec($ch);

This code works fine on my local webserver, and I also tested it on another
test server. But when I put it online on the real server it get a fault.
I did a little research and discovered the problem. But I don't know how I
can solve it.

On my local webserver and test server I receive (in the $pagecontents) html
header http/1.1. And everything works fine. But on my real server I receive
html header http/1.0 and "Object Removed". One way or the other this curl
syntax doesn't work with http/1.0.

I tried the option CURLOPT_HTTP_VERSION with CURL_HTTP_VERSION_1_1 but still
it's not working.

Is there someone who know how I can work around this? Or how I can
manipulate it so that it works with http/1.1?


Greetings,
Wim
Wim Kumpen [ Di, 23 Januar 2007 23:51 ] [ ID #1605337 ]

Re: curl - html/1.0

On Tue, 23 Jan 2007 23:51:10 +0100, Wim Kumpen <wim.kumpen [at] telenet.be> =

wrote:

> Hey,
>
> I have to following code
>
> curl_setopt($ch, CURLOPT_URL,
> "http://collect.myspace.com/index.cfm?fuseaction=3Dinvite.ad dfriend_ve=
rify&friendID=3D"
> . $fid);
> curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
> curl_setopt($ch, CURLOPT_HEADER, 1);
> curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
> curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
> curl_setopt($ch, CURLOPT_HTTPHEADER, $header_myspace_home);
> curl_setopt($ch, CURLOPT_USERAGENT, $agent);
> $pagecontents =3D curl_exec($ch);
>
> This code works fine on my local webserver, and I also tested it on =

> another
> test server. But when I put it online on the real server it get a faul=
t.
> I did a little research and discovered the problem. But I don't know h=
ow =

> I
> can solve it.
>
> On my local webserver and test server I receive (in the $pagecontents)=
=

> html
> header http/1.1. And everything works fine. But on my real server I =

> receive
> html header http/1.0 and "Object Removed". One way or the other this c=
url
> syntax doesn't work with http/1.0.
>
> I tried the option CURLOPT_HTTP_VERSION with CURL_HTTP_VERSION_1_1 but=
=

> still
> it's not working.
>
> Is there someone who know how I can work around this? Or how I can
> manipulate it so that it works with http/1.1?
>
>
> Greetings,
> Wim
>
>

Hi Wim!


Does your $header_myspace_home contain any http version by chance?

My curl implementations haven't needed CURLOPT_HTTP_VERSION thus far.

You may want to set CURLOPT_FOLLOWLOCATION to 1, that way if the =

requested page moved (from http://www.nu.nl/ to http://nu.nl/, for =

instance) your curl will still be able to retrieve it.

Groeten uit Nederland!

-- =

Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
OmegaJunior [ Mi, 24 Januar 2007 00:02 ] [ ID #1605338 ]

Re: curl - html/1.0

On Tue, 23 Jan 2007 23:51:10 +0100, Wim Kumpen <wim.kumpen [at] telenet.be> =

wrote:

> Hey,
>
> I have to following code
>
> curl_setopt($ch, CURLOPT_URL,
> "http://collect.myspace.com/index.cfm?fuseaction=3Dinvite.ad dfriend_ve=
rify&friendID=3D"
> . $fid);
> curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
> curl_setopt($ch, CURLOPT_HEADER, 1);
> curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
> curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
> curl_setopt($ch, CURLOPT_HTTPHEADER, $header_myspace_home);
> curl_setopt($ch, CURLOPT_USERAGENT, $agent);
> $pagecontents =3D curl_exec($ch);
>
> This code works fine on my local webserver, and I also tested it on =

> another
> test server. But when I put it online on the real server it get a faul=
t.
> I did a little research and discovered the problem. But I don't know h=
ow =

> I
> can solve it.
>
> On my local webserver and test server I receive (in the $pagecontents)=
=

> html
> header http/1.1. And everything works fine. But on my real server I =

> receive
> html header http/1.0 and "Object Removed". One way or the other this c=
url
> syntax doesn't work with http/1.0.
>
> I tried the option CURLOPT_HTTP_VERSION with CURL_HTTP_VERSION_1_1 but=
=

> still
> it's not working.
>
> Is there someone who know how I can work around this? Or how I can
> manipulate it so that it works with http/1.1?
>
>
> Greetings,
> Wim
>
>

Hi Wim!


Does your $header_myspace_home contain any http version by chance?

My curl implementations haven't needed CURLOPT_HTTP_VERSION thus far.

You may want to set CURLOPT_FOLLOWLOCATION to 1, that way if the =

requested page moved (from http://www.nu.nl/ to http://nu.nl/, for =

instance) your curl will still be able to retrieve it.

Groeten uit Nederland!

-- =

Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
OmegaJunior [ Mi, 24 Januar 2007 00:02 ] [ ID #1605397 ]

Re: curl - html/1.0

"OmegaJunior" <omegajunior [at] spamremove.home.nl> schreef in bericht
news:op.tmmqam1o70mclq [at] cp139795-a.landg1.lb.home.nl...
On Tue, 23 Jan 2007 23:51:10 +0100, Wim Kumpen <wim.kumpen [at] telenet.be>
wrote:

> Hey,
>
> I have to following code
>
> curl_setopt($ch, CURLOPT_URL,
> "http://collect.myspace.com/index.cfm?fuseaction=invite.addf riend_verify&friendID="
> . $fid);
> curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
> curl_setopt($ch, CURLOPT_HEADER, 1);
> curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
> curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
> curl_setopt($ch, CURLOPT_HTTPHEADER, $header_myspace_home);
> curl_setopt($ch, CURLOPT_USERAGENT, $agent);
> $pagecontents = curl_exec($ch);
>
> This code works fine on my local webserver, and I also tested it on
> another
> test server. But when I put it online on the real server it get a fault.
> I did a little research and discovered the problem. But I don't know how
> I
> can solve it.
>
> On my local webserver and test server I receive (in the $pagecontents)
> html
> header http/1.1. And everything works fine. But on my real server I
> receive
> html header http/1.0 and "Object Removed". One way or the other this curl
> syntax doesn't work with http/1.0.
>
> I tried the option CURLOPT_HTTP_VERSION with CURL_HTTP_VERSION_1_1 but
> still
> it's not working.
>
> Is there someone who know how I can work around this? Or how I can
> manipulate it so that it works with http/1.1?
>
>
> Greetings,
> Wim
>
>

>>Hi Wim!
>>
>>
>>Does your $header_myspace_home contain any http version by chance?
>>
>>My curl implementations haven't needed CURLOPT_HTTP_VERSION thus far.
>>
>>You may want to set CURLOPT_FOLLOWLOCATION to 1, that way if the
>>requested page moved (from http://www.nu.nl/ to http://nu.nl/, for
>>instance) your curl will still be able to retrieve it.
>>
>>Groeten uit Nederland!
>>

Hey,

$agent="Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
$header_myspace_collect = array("Host:
collect.myspace.com",$agent,"Content-Type:
application/x-www-form-urlencoded","Content-Length: " . $contentlength);
$header_myspace_home = array("Host: home.myspace.com",$agent);

I tried changing followlocation to 1 and then I don't get this fault. But
then I don't get what I want. So I can't do this.
Maybe if I change something in my $agent of $header?

thanks for replying

Groetjes uit België :-)
Wim Kumpen [ Mi, 24 Januar 2007 07:32 ] [ ID #1606647 ]

Re: curl - html/1.0

On Wed, 24 Jan 2007 07:32:38 +0100, Wim Kumpen <wim.kumpen [at] telenet.be>
wrote:

>
> "OmegaJunior" <omegajunior [at] spamremove.home.nl> schreef in bericht
> news:op.tmmqam1o70mclq [at] cp139795-a.landg1.lb.home.nl...
> On Tue, 23 Jan 2007 23:51:10 +0100, Wim Kumpen <wim.kumpen [at] telenet.be>
> wrote:
>
>> Hey,
>>
>> I have to following code
>>
>> curl_setopt($ch, CURLOPT_URL,
>> "http://collect.myspace.com/index.cfm?fuseaction=invite.addf riend_verify&friendID="
>> . $fid);
>> curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
>> curl_setopt($ch, CURLOPT_HEADER, 1);
>> curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
>> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
>> curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
>> curl_setopt($ch, CURLOPT_HTTPHEADER, $header_myspace_home);
>> curl_setopt($ch, CURLOPT_USERAGENT, $agent);
>> $pagecontents = curl_exec($ch);
>>
>> This code works fine on my local webserver, and I also tested it on
>> another
>> test server. But when I put it online on the real server it get a fault.
>> I did a little research and discovered the problem. But I don't know how
>> I
>> can solve it.
>>
>> On my local webserver and test server I receive (in the $pagecontents)
>> html
>> header http/1.1. And everything works fine. But on my real server I
>> receive
>> html header http/1.0 and "Object Removed". One way or the other this
>> curl
>> syntax doesn't work with http/1.0.
>>
>> I tried the option CURLOPT_HTTP_VERSION with CURL_HTTP_VERSION_1_1 but
>> still
>> it's not working.
>>
>> Is there someone who know how I can work around this? Or how I can
>> manipulate it so that it works with http/1.1?
>>
>>
>> Greetings,
>> Wim
>>
>>
>
>>> Hi Wim!
>>>
>>>
>>> Does your $header_myspace_home contain any http version by chance?
>>>
>>> My curl implementations haven't needed CURLOPT_HTTP_VERSION thus far.
>>>
>>> You may want to set CURLOPT_FOLLOWLOCATION to 1, that way if the
>>> requested page moved (from http://www.nu.nl/ to http://nu.nl/, for
>>> instance) your curl will still be able to retrieve it.
>>>
>>> Groeten uit Nederland!
>>>
>
> Hey,
>
> $agent="Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
> $header_myspace_collect = array("Host:
> collect.myspace.com",$agent,"Content-Type:
> application/x-www-form-urlencoded","Content-Length: " . $contentlength);
> $header_myspace_home = array("Host: home.myspace.com",$agent);
>
> I tried changing followlocation to 1 and then I don't get this fault. But
> then I don't get what I want. So I can't do this.
> Maybe if I change something in my $agent of $header?
>
> thanks for replying
>
> Groetjes uit België :-)
>
>

You do
curl_setopt($ch, CURLOPT_HTTPHEADER, $header_myspace_home);
with
$header_myspace_home = array("Host: home.myspace.com",$agent);
and
$agent="Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
?

Wouldn't that result in a header looking like (what I think is wrong):

Host: home.myspace.com
Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)

instead of (what I think is correct):

Host: home.myspace.com
User-agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)

?

I may have this wrong, but I think the first header results in a lot of
garbage, resulting in an erroneous response.

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
OmegaJunior [ Mi, 24 Januar 2007 21:58 ] [ ID #1606657 ]

Re: curl - html/1.0

"OmegaJunior" <omegajunior [at] spamremove.home.nl> schreef in bericht
news:op.tmmqam1o70mclq [at] cp139795-a.landg1.lb.home.nl...
On Tue, 23 Jan 2007 23:51:10 +0100, Wim Kumpen <wim.kumpen [at] telenet.be>
wrote:

> Hey,
>
> I have to following code
>
> curl_setopt($ch, CURLOPT_URL,
> "http://collect.myspace.com/index.cfm?fuseaction=invite.addf riend_verify&friendID="
> . $fid);
> curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
> curl_setopt($ch, CURLOPT_HEADER, 1);
> curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
> curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
> curl_setopt($ch, CURLOPT_HTTPHEADER, $header_myspace_home);
> curl_setopt($ch, CURLOPT_USERAGENT, $agent);
> $pagecontents = curl_exec($ch);
>
> This code works fine on my local webserver, and I also tested it on
> another
> test server. But when I put it online on the real server it get a fault.
> I did a little research and discovered the problem. But I don't know how
> I
> can solve it.
>
> On my local webserver and test server I receive (in the $pagecontents)
> html
> header http/1.1. And everything works fine. But on my real server I
> receive
> html header http/1.0 and "Object Removed". One way or the other this curl
> syntax doesn't work with http/1.0.
>
> I tried the option CURLOPT_HTTP_VERSION with CURL_HTTP_VERSION_1_1 but
> still
> it's not working.
>
> Is there someone who know how I can work around this? Or how I can
> manipulate it so that it works with http/1.1?
>
>
> Greetings,
> Wim
>
>

>>Hi Wim!
>>
>>
>>Does your $header_myspace_home contain any http version by chance?
>>
>>My curl implementations haven't needed CURLOPT_HTTP_VERSION thus far.
>>
>>You may want to set CURLOPT_FOLLOWLOCATION to 1, that way if the
>>requested page moved (from http://www.nu.nl/ to http://nu.nl/, for
>>instance) your curl will still be able to retrieve it.
>>
>>Groeten uit Nederland!
>>

Hey,

$agent="Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
$header_myspace_collect = array("Host:
collect.myspace.com",$agent,"Content-Type:
application/x-www-form-urlencoded","Content-Length: " . $contentlength);
$header_myspace_home = array("Host: home.myspace.com",$agent);

I tried changing followlocation to 1 and then I don't get this fault. But
then I don't get what I want. So I can't do this.
Maybe if I change something in my $agent of $header?

thanks for replying

Groetjes uit België :-)
Wim Kumpen [ Mi, 24 Januar 2007 07:32 ] [ ID #1606680 ]

Re: curl - html/1.0

On Wed, 24 Jan 2007 07:32:38 +0100, Wim Kumpen <wim.kumpen [at] telenet.be>
wrote:

>
> "OmegaJunior" <omegajunior [at] spamremove.home.nl> schreef in bericht
> news:op.tmmqam1o70mclq [at] cp139795-a.landg1.lb.home.nl...
> On Tue, 23 Jan 2007 23:51:10 +0100, Wim Kumpen <wim.kumpen [at] telenet.be>
> wrote:
>
>> Hey,
>>
>> I have to following code
>>
>> curl_setopt($ch, CURLOPT_URL,
>> "http://collect.myspace.com/index.cfm?fuseaction=invite.addf riend_verify&friendID="
>> . $fid);
>> curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
>> curl_setopt($ch, CURLOPT_HEADER, 1);
>> curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
>> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
>> curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
>> curl_setopt($ch, CURLOPT_HTTPHEADER, $header_myspace_home);
>> curl_setopt($ch, CURLOPT_USERAGENT, $agent);
>> $pagecontents = curl_exec($ch);
>>
>> This code works fine on my local webserver, and I also tested it on
>> another
>> test server. But when I put it online on the real server it get a fault.
>> I did a little research and discovered the problem. But I don't know how
>> I
>> can solve it.
>>
>> On my local webserver and test server I receive (in the $pagecontents)
>> html
>> header http/1.1. And everything works fine. But on my real server I
>> receive
>> html header http/1.0 and "Object Removed". One way or the other this
>> curl
>> syntax doesn't work with http/1.0.
>>
>> I tried the option CURLOPT_HTTP_VERSION with CURL_HTTP_VERSION_1_1 but
>> still
>> it's not working.
>>
>> Is there someone who know how I can work around this? Or how I can
>> manipulate it so that it works with http/1.1?
>>
>>
>> Greetings,
>> Wim
>>
>>
>
>>> Hi Wim!
>>>
>>>
>>> Does your $header_myspace_home contain any http version by chance?
>>>
>>> My curl implementations haven't needed CURLOPT_HTTP_VERSION thus far.
>>>
>>> You may want to set CURLOPT_FOLLOWLOCATION to 1, that way if the
>>> requested page moved (from http://www.nu.nl/ to http://nu.nl/, for
>>> instance) your curl will still be able to retrieve it.
>>>
>>> Groeten uit Nederland!
>>>
>
> Hey,
>
> $agent="Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
> $header_myspace_collect = array("Host:
> collect.myspace.com",$agent,"Content-Type:
> application/x-www-form-urlencoded","Content-Length: " . $contentlength);
> $header_myspace_home = array("Host: home.myspace.com",$agent);
>
> I tried changing followlocation to 1 and then I don't get this fault. But
> then I don't get what I want. So I can't do this.
> Maybe if I change something in my $agent of $header?
>
> thanks for replying
>
> Groetjes uit België :-)
>
>

You do
curl_setopt($ch, CURLOPT_HTTPHEADER, $header_myspace_home);
with
$header_myspace_home = array("Host: home.myspace.com",$agent);
and
$agent="Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
?

Wouldn't that result in a header looking like (what I think is wrong):

Host: home.myspace.com
Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)

instead of (what I think is correct):

Host: home.myspace.com
User-agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)

?

I may have this wrong, but I think the first header results in a lot of
garbage, resulting in an erroneous response.

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
OmegaJunior [ Mi, 24 Januar 2007 21:58 ] [ ID #1606744 ]
PHP » alt.php » curl - html/1.0

Vorheriges Thema: Help with multiple table delete
Nächstes Thema: Re: Pingy: Spacey Gurl