473,394 Members | 1,679 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,394 software developers and data experts.

curl - html/1.0

Hey,

I have to following code

curl_setopt($ch, CURLOPT_URL,
"http://collect.myspace.com/index.cfm?fuseaction=invite.addfriend_verify&frien dID="
.. $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
Jan 23 '07 #1
3 5723
On Tue, 23 Jan 2007 23:51:10 +0100, Wim Kumpen <wi********@telenet.be
wrote:
Hey,

I have to following code

curl_setopt($ch, CURLOPT_URL,
"http://collect.myspace.com/index.cfm?fuseaction=invite.addfriend_verify&frien dID="
. $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!

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Jan 23 '07 #2

"OmegaJunior" <om*********@spamremove.home.nlschreef in bericht
news:op***************@cp139795-a.landg1.lb.home.nl...
On Tue, 23 Jan 2007 23:51:10 +0100, Wim Kumpen <wi********@telenet.be>
wrote:
Hey,

I have to following code

curl_setopt($ch, CURLOPT_URL,
"http://collect.myspace.com/index.cfm?fuseaction=invite.addfriend_verify&frien dID="
. $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ë :-)
Jan 24 '07 #3
On Wed, 24 Jan 2007 07:32:38 +0100, Wim Kumpen <wi********@telenet.be>
wrote:
>
"OmegaJunior" <om*********@spamremove.home.nlschreef in bericht
news:op***************@cp139795-a.landg1.lb.home.nl...
On Tue, 23 Jan 2007 23:51:10 +0100, Wim Kumpen <wi********@telenet.be>
wrote:
>Hey,

I have to following code

curl_setopt($ch, CURLOPT_URL,
"http://collect.myspace.com/index.cfm?fuseaction=invite.addfriend_verify&frien dID="
. $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/
Jan 24 '07 #4

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

Similar topics

1
by: D Benfer | last post by:
Hi all, Im a bit thrown by curl. I want to submit some order data on an ecommerce site via a form to a php page, where the data is saved to a database. Then I want to use curl to submit the form...
0
by: Phil Powell | last post by:
I am having trouble retrieving URLs using curl for PHP whereby the URL requires a cookie to produce proper data. I wrote a wrapper class called Timer that will time the execution/download of a...
0
by: Phil Powell | last post by:
What is the most standardized method of utilizing the CURL functions in PHP (version 4.3.2) to be able to retrieve the contents of a remote URL that happens to be dependent upon $_SESSION for its...
3
by: Chris Fortune | last post by:
# uname -a Linux stargate.mxc-online.net 2.4.20-021stab022.2.777-smp #1 SMP Wed Jul 28 17:12:37 MSD 2004 i686 i686 i386 GNU/Linux I recompiled PHP with mcrypt, openssl, and curl phpinfo():...
9
by: Conrad F | last post by:
Hi, If any Microsoft people are listening.... Are there any plans for the new web language called "Curl" to be supported in .NET (ASP.NET)? I ask as Curl represents the first step to true OO...
6
by: Wescotte | last post by:
I'm writing a tiny php app that will log into our bank of america account and retrieve a file containing a list of checks that cleared the previous day. The problem I'm running into is when I...
1
by: ynotssor | last post by:
Hello, can someone please tell me the correct way to use "curl" to complete an online form? I am trying to eventually retrieve my account balance via a cron job that will email me the parsed output...
2
by: lookee | last post by:
Hello all, I have simple PHP application that on one page strarts session and write some information to it. On another page program tryes to fetch information from a third page using cURL. On that...
3
by: Matthias Leopold | last post by:
hi i've got problems getting php4 scripts which use curl to work on RHEL4 (Nahant Update 4) and CentOS 4.4. when the script is accessed the browser "hangs", after a couple of minutes i'm...
4
by: rottmanj | last post by:
I am working on a revamp of a previous application that I have written in coldfusion. The application deals with RETS data. The issue that I am having is with using the curl option HTTP_AUTH and...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
jinu1996
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...
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.