CURL is broken

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

CURL is broken

Post by SidewinderX »

Code: Select all

<?php
   $ch = curl_init();
   curl_setopt($ch, CURLOPT_URL, "https://www.novaworld.com/Players/Stats.aspx?id=33680801261&p=616065");
   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, 1);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
   $returned = curl_exec($ch);
   curl_error($ch);
   curl_close($ch);
   echo $returned;
?>
I give up, CURL does not work with that URL on any of my 4 of my servers, all running different versions of php and different versions of curl and openssl. One of them even has the latest versions of curl and openssl with php 4.4.4

Im pretty sure my code is correct because it works with other secure sites such as https://www.google.com/adsense/. If i had money i'd pay someone to figure this out, but im broke, and I know someone in these forums knows whats wrong.

So dont be shy and post the answer :D
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

And the question/problem is.. *drum roll*







... we don't know yet!
SidewinderX
Forum Contributor
Posts: 407
Joined: Fri Jul 16, 2004 9:04 pm
Location: NY

Post by SidewinderX »

The problem is the above code does not work and it should.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Help us help you, what are you getting back? Error messages? Have you considered using file_get_contents()?
SidewinderX
Forum Contributor
Posts: 407
Joined: Fri Jul 16, 2004 9:04 pm
Location: NY

Post by SidewinderX »

Jcart wrote:Help us help you, what are you getting back? Error messages? Have you considered using file_get_contents()?
I appologize for my lousey posting, im just so fed up...



I get no error, no response.
Live example: http://www.extreme-hq.com/development/connect/curl.php

Yes I have concidered file_get_contents

Code: Select all

<?php
	$url = "https://www.novaworld.com/Players/Stats.aspx?id=33680801261&p=616065";
	$content = file_get_contents($url);
	echo $content;
?>
Live example: http://www.extreme-hq.com/development/connect/fgc.php (dosnt work either)


Odds are, if you test the script yourself, you will get the same problem.
SidewinderX
Forum Contributor
Posts: 407
Joined: Fri Jul 16, 2004 9:04 pm
Location: NY

Post by SidewinderX »

Ive just tried this script on another server running php 5. I figured maybe it was something with 4.x as my test server is running 5.0.4 and it works fine. However it does not work.

Any other dieas? :roll:
printf
Forum Contributor
Posts: 173
Joined: Wed Jan 12, 2005 5:24 pm

Post by printf »

Maybe try it like this...

this will write any errors to the file called ./information.txt, change that name and path to where you want the file written! I also changed your SSL curl options, because you can't set verifypeer to false and then set verifyhost to true.

Code: Select all

<?php
   $ch = curl_init();
   curl_setopt($ch, CURLOPT_URL, "https://www.novaworld.com/Players/Stats.aspx?id=33680801261&p=616065");
   curl_setopt($ch, CURLOPT_VERBOSE, 1);
   curl_setopt($ch, CURLOPT_STDERR, './information.txt');
   curl_setopt($ch, CURLOPT_USERAGENT,  "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
   curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
   $returned = curl_exec($ch);
   curl_close($ch);
   echo $returned;
?>

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

Post by SidewinderX »

thank you for the reply, but it still dosnt load nor generate a log, i just created that script in my root directory and removed the path to look like this

Code: Select all

<?php
   $ch = curl_init();
   curl_setopt($ch, CURLOPT_URL, "https://www.novaworld.com/Players/Stats.aspx?id=33680801261&p=616065");
   curl_setopt($ch, CURLOPT_VERBOSE, 1);
   curl_setopt($ch, CURLOPT_STDERR, 'information.txt');
   curl_setopt($ch, CURLOPT_USERAGENT,  "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
   curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
   $returned = curl_exec($ch);
   curl_close($ch);
   echo $returned;
?>
i suppose that would work


However, after numerous emails between me and my host we've concluded that the server is being blocked from connecting to novaworld.com for unknown reasons. When tested, we cant ping the server or wget the url. I suppose novaworld.com has aquired a large log of webservers and blocked them as even my new server (purchaced 3 days ago) does not work either, which i assume is why it works perfectly fine from my home server, but not any commercial server.

Now to find a proxy that I can use to connect :evil:

Im open to other suggestions also
Post Reply