Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 09-04-2010, 11:25 PM Curl Help
Skilled Talker

Posts: 64
Name: Ralph Freshour
Trades: 0
I can't get the following curl to fetch my cpanel web page. Is it because I'm using an IP address? Does curl not work with IP addresses?

Thanks

PHP Code:
     $ch curl_init(); 
     
curl_setopt($chCURLOPT_URL"https://xxx.xxx.xxx.xxx:2083/frontend/x3/index.html"); 
     
curl_setopt($chCURLOPT_POST0); 
     
curl_setopt($chCURLOPT_USERPWD"username:password"); 
     
curl_setopt($chCURLOPT_RETURNTRANSFER1); 
     
curl_setopt($chCURLOPT_TIMEOUT0); 
     
$view curl_exec($ch); 
     print 
$view
     
curl_close($ch); 
__________________
RalphF
Business Text Messaging Services

Please login or register to view this content. Registration is FREE
rfresh is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-05-2010, 01:03 AM Re: Curl Help
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
cURL should work fine with an IP address. Using curl_error might shed some light on why its not working.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is offline
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 09-06-2010, 09:27 PM Re: Curl Help
Junior Talker

Posts: 3
Name: James
Trades: 0
Yes Dear its not the problem which type of domain you are using PHP always depands upone the server not on the domain.
__________________

Please login or register to view this content. Registration is FREE
forball100 is offline
Reply With Quote
View Public Profile
 
Old 09-08-2010, 01:32 PM Re: Curl Help
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
I think with cURL you have to specify the port via curl_setopt(). Also as your sending a username and passed you need to tell cURL. For example:
PHP Code:
$ch curl_init(); 
curl_setopt($chCURLOPT_URL"https://xxx.xxx.xxx.xxx:2083/frontend/x3/index.html"); 
curl_setopt($chCURLOPT_POST0); 
curl_setopt($chCURLOPT_USERPWD"username:password"); 
curl_setopt($chCURLOPT_RETURNTRANSFER1); 
//curl_setopt($ch, CURLOPT_TIMEOUT, 0); // Took out this - I would leave it as default. 
curl_setopt($chCURLOPT_PORT'2083'); // Added this
curl_setopt($chCURLOPT_VERBOSE1); // Added this
curl_setopt($chCURLOPT_HTTP_VERSIONCURL_HTTP_VERSION_1_1); // Added this
curl_setopt($chCURLOPT_HTTPAUTHCURLAUTH_BASIC); // Added this
$view curl_exec($ch); 
echo 
$view// echo is faster then print. 
var_dump(curl_getinfo($ch)); // Also added this, it will output the header infomation.
curl_close($ch); 
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE

Last edited by rogem002; 09-08-2010 at 01:34 PM..
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Reply     « Reply to Curl Help
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13094 seconds with 12 queries