Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 6th, 2008, 6:38 PM   #1
grimpirate
King of Portal
 
grimpirate's Avatar
 
Join Date: Sep 2005
Posts: 431
Rep Power: 4 grimpirate is on a distinguished road
Send a message via Yahoo to grimpirate
cURL and sockets

Is there any possible way to open a socket connection using the cURL functions in php? Tried this but to no avail:
php Syntax (Toggle Plain Text)
  1. <pre><?php
  2. $url = 'irc.freenode.net';
  3. $ch = curl_init();
  4. $timeout = 10;
  5. curl_setopt($ch, CURLOPT_URL, $url);
  6. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  7. curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
  8. curl_setopt($ch, CURLOPT_PORT, 6667);
  9. curl_setopt($ch, CURLOPT_FAILONERROR, true);
  10. $output = @curl_exec($ch);
  11. print_r(curl_getinfo($ch));
  12. echo "\n\ncURL error number:" .curl_errno($ch);
  13. echo "\n\ncURL error:" . curl_error($ch);
  14. curl_close($ch);
  15. ?>
  16. </pre>
It resulted in the following:
Quote:
Array
(
[url] => http://irc.freenode.net
[http_code] => 500
[header_size] => 0
[request_size] => 73
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 3.052355
[namelookup_time] => 0.380917
[connect_time] => 2.857148
[pretransfer_time] => 2.857186
[size_upload] => 0
[size_download] => 0
[speed_download] => 0
[speed_upload] => 0
[download_content_length] => 0
[upload_content_length] => 0
[starttransfer_time] => 3.052325
[redirect_time] => 0
)


cURL error number:22

cURL error:The requested URL returned error: 500
When I attempted to change the $url string to 'irc://irc.freenode.net/' it said it didn't support the irc protocol. Any ideas? I don't have access to the fsockopen() function.
__________________
Lo, there do I see my father. 'Lo, there do I see My mother, and my sisters, and my brothers. 'Lo, there do I see The line of my people... Back to the beginning. 'Lo, they do call to me. They bid me take my place among them. In the halls of Valhalla... Where the brave... May live... ...forever.. GrimBB | Mimesis
grimpirate is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:51 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC