Connection Issue

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
SidewinderX
Forum Contributor
Posts: 407
Joined: Fri Jul 16, 2004 9:04 pm
Location: NY

Connection Issue

Post by SidewinderX »

Well ive posted this question before and got some intellegent responses but none of them were correct and the post kind of fell off topic so im creating a new one.

I have two scripts that do virtually the same thing, however for this particular URL they do not work...

Code: Select all

<?php
   $url = "https://www.novaworld.com/Players/Stats.aspx?id=33680801261&p=616065";

   $ch = curl_init();
   curl_setopt($ch, CURLOPT_URL,$url);
   curl_setopt($ch, CURLOPT_VERBOSE, 1);
   curl_setopt($ch, CURLOPT_POST, 0);
   curl_setopt($ch, CURLOPT_USERAGENT,  "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
   curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
   $returned = curl_exec($ch);
   curl_error($ch);
   curl_close($ch);

   echo $returned;
?>
and

Code: Select all

<?php
$url= "https://www.novaworld.com/Players/Stats.aspx?id=33680801261&p=616065";
$content = file_get_contents($url);
echo $content;
?>
the URL im having troubell with is already set
Ive tried these scripts on three servers now. On my home development windows server they both work fine, on my other two remote (linux) servers (hosted by two different companies) the scripts do not work. Ive checked with my hosts and they DO allow outgoing secure connection and cURL DOES work because the script works using this as the URL

Code: Select all

$url = "https://adwords.google.com/select/Login";
https IS a registered stream and my IP's are NOT blocked from the website im trying to connect to. I've tried different the user-agent headers and it still does not work.

I think ive read almost every post regarding using cURL and https connections and what ive done covers it all (i think) any ideas?

Thank You
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

When you say "they do not work", how exactly do they not work? Do they hang? Return an error? Return the "Search NovaWorld Players" screen? Is it "do not work" different for the two pieces of code, or the same?
(#10850)
miro_igov
Forum Contributor
Posts: 485
Joined: Fri Mar 31, 2006 5:06 am
Location: Bulgaria

Post by miro_igov »

I bet you don't have CURL installed (as reason of not working for the first script) and allow_url_fopen is off and the second script does not work

is that true ?
SidewinderX
Forum Contributor
Posts: 407
Joined: Fri Jul 16, 2004 9:04 pm
Location: NY

Post by SidewinderX »

arborint wrote:When you say "they do not work", how exactly do they not work? Do they hang? Return an error? Return the "Search NovaWorld Players" screen? Is it "do not work" different for the two pieces of code, or the same?
They take about 6 minutes to load then return nothing, here is my live examples

Connection to novaworld using file_get_contents: {dosnt work}
http://www.extreme-hq.com/development/c ... ntents.php
http://www.extreme-hq.com/development/c ... tents.phps <= source

Connection to novaworld using curl: {dosnt work}
http://www.extreme-hq.com/development/c ... ldCURL.php
http://www.extreme-hq.com/development/c ... dCURL.phps <= source

Connection to secure google ads using file_get_contents: {works but has an error}
http://www.extreme-hq.com/development/c ... ntents.php
http://www.extreme-hq.com/development/c ... tents.phps <= source

Connection to secure google ads using cURL: {works}
http://www.extreme-hq.com/development/c ... leCURL.php
http://www.extreme-hq.com/development/c ... eCURL.phps <= source
miro_igov wrote:I bet you don't have CURL installed (as reason of not working for the first script) and allow_url_fopen is off and the second script does not work

is that true ?
curl IS installed and allow_url_fopen IS on as you can see from my phpinfo file http://www.extreme-hq.com/development/c ... hpinfo.php

And i just realized that on my google file_get_contents script im getting this error
Warning: file_get_contents() [function.file-get-contents]: SSL: fatal protocol error in /home/extreme/public_html/development/connect/connectGoogleFileGetContents.php on line 4
ill look into that while i wait for some more responses.

Thank you

edit:

Error Reason
When using SSL, Microsoft IIS will violate the protocol by closing the connection without sending a close_notify indicator. PHP will report this as "SSL: Fatal Protocol Error" when you reach the end of the data. To workaround this, you should lower your error_reporting level not to include warnings. PHP 4.3.7 and higher can detect buggy IIS server software when you open the stream using the https:// wrapper and will suppress the warning for you. If you are using fsockopen() to create an ssl:// socket, you are responsible for detecting and suppressing the warning yourself.
im not sure why, if this error is a result of using SSL with Microsoft's IIS when im using SSL with Linux's apache :?: oh well, it dosnt seem like a big problem anyway
miro_igov
Forum Contributor
Posts: 485
Joined: Fri Mar 31, 2006 5:06 am
Location: Bulgaria

Post by miro_igov »

SidewinderX wrote: im not sure why, if this error is a result of using SSL with Microsoft's IIS when im using SSL with Linux's apache :?: oh well, it dosnt seem like a big problem anyway
https://www.novaworld.com/nonexistingpage
as you can see the novaworld server is IIS.
SidewinderX
Forum Contributor
Posts: 407
Joined: Fri Jul 16, 2004 9:04 pm
Location: NY

Post by SidewinderX »

miro_igov wrote:
SidewinderX wrote: im not sure why, if this error is a result of using SSL with Microsoft's IIS when im using SSL with Linux's apache :?: oh well, it dosnt seem like a big problem anyway
https://www.novaworld.com/nonexistingpage
as you can see the novaworld server is IIS.
oh well i assumed the error would be a result of the server that is running the php file not the server it is connecting to

and

i get that error with i run the file_get_contents using the google url NOT novaworld...and im just asuming google dosnt use windows for their servers...

i receive no error when i file_get_contents or curl the novaworld url as the live examples show
SidewinderX
Forum Contributor
Posts: 407
Joined: Fri Jul 16, 2004 9:04 pm
Location: NY

Post by SidewinderX »

any one have any other ideas?

it works on this server http://www.extras.kos-site.co.uk/server_info.php

i tried comparing the phpinfo between my server and that server there isnt anything significantly different that i can see
Post Reply