Jump to content

Pro.Luv

Members
  • Posts

    33
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Pro.Luv's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi, I'm trying to call a .net(.asmx) webservice and it just doesn't work, I really need help with this. require("nusoap.php"); $client = new nusoap_client('http://www.w3schools.com/webservices/tempconvert.asmx?wsdl', true); $err = $client->getError(); if($err){ Print '<h2>Constructor error</h2><pre>'.$err.'</pre>'; } $param = array('Celsius' => '12') ; //PARAMETERS $function = 'CelsiusToFahrenheit'; //FUNCTION IM CALLING $result = $client->call($function, $param); if ($client->fault) { Print '<h2>Fault</h2><pre>'; print_r($result); Print '</pre>'; } else { $err = $client->getError(); // Check for errors if ($err) { Print '<h2>Error</h2><pre>'.$err.'</pre>'; // Display the error } else { // Display the result Print '<h2>Result</h2><pre>'; print_r($result); Print '</pre>'; } } Thanks !
  2. Hi, I'm having a problem using ftp_rawlist when I chmod a file the permissions are updated but it doesn't show when I list the files it shows the file's old permissions, but when I view the file permissions using FileZilla it shows that the file has been updated. Example: Before ftp_chmod file.php -rw-r--r-- After I chmod the file using the code below it still shows the -rw-r--r-- permissions it doesn't update but using filezilla shows that it's permissions have been updated. This is the FTP_chmod code that I use: $conn_id = ftp_connect($host); $login_result = ftp_login($conn_id, $user, $pass); $file = $_GET["file"]; if (ftp_chmod($conn_id, 0644, $file) !== false) { Print "$file chmoded successfully to 0644\n"; } else { Print "could not chmod $file\n"; } This is the function that I use to list the files on a server: function raw_listing($conn, $path){ $list = ftp_rawlist($conn, "./"); //GET RAW DIRECTORY LIST $i = 0; foreach ($list as $current) { $split = preg_split("[ ]", $current, 9, PREG_SPLIT_NO_EMPTY); if ($split[0] != "total") { $parsed[$i]['isdir'] = $split[0]{0} === "d"; $parsed[$i]['perms'] = $split[0]; $parsed[$i]['number'] = $split[1]; $parsed[$i]['owner'] = $split[2]; $parsed[$i]['group'] = $split[3]; $parsed[$i]['size'] = $split[4]; $parsed[$i]['month'] = $split[5]; $parsed[$i]['day'] = $split[6]; $parsed[$i]['time/year'] = $split[7]; $parsed[$i]['name'] = $split[8]; $i++; } } return $parsed; } The listing of the files seem fine but it's only the permissions that show wrong. Thanks
  3. Hi, I need help with this code it does work I need to know how I can send back data from the server.php to the client.php.. Client.php /* Open a socket to port 1234 on localhost */ $socket = stream_socket_client('tcp://127.0.0.1:1234'); /* Send more data out of band. */ stream_socket_sendto($socket, "This Data", STREAM_OOB); /* Close it up */ fclose($socket); Server.php // Open a server socket to port 1234 on localhost $server = stream_socket_server('tcp://127.0.0.1:1234'); // Accept a connection $socket = stream_socket_accept($server); echo "Waiting for data from client..."; // Output recieved data $data = stream_socket_recvfrom($socket, 1500); echo "Data: ".$data."\n"; //do something here then send results back. // Close it up fclose($socket); fclose($server); The client sends This Data to the server and the server retrieves it... I need to know what must I add to the server.php to send back data ? In server.php: I want to take the data being sent from the client.php and search it in the database then send back results to the client for displaying. Thanks
  4. Thanks alot for the reply, the client.php is right ? is there anything I need to add in there so that I can send data to the server.php ? Really appreciate your help. My server.php now is: $socket = socket_create(AF_INET,SOCK_STREAM,SOL_TCP); socket_bind($socket,'127.0.0.1', $port); socket_listen($socket); while(true) { if(is_resource($newSocket = socket_accept($socket))) { // do something with $newSocket echo $newSocket; socket_close($newSocket); } } socket_close($socket);
  5. Hi, I read online documentation but I stil can't get this right I need to create a PHP page that will send data to another PHP page using sockets so far I got this: client.php function ping($host) { $package = "\x08\x00\x19\x2f\x00\x00\x00\x00\x70\x69\x6e\x67"; /* create the socket, the last '1' denotes ICMP */ $socket = socket_create(AF_INET, SOCK_RAW, 1); /* set socket receive timeout to 1 second */ socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, array("sec" => 1, "usec" => 0)); /* connect to socket */ socket_connect($socket, $host, null); /* record start time */ list($start_usec, $start_sec) = explode(" ", microtime()); $start_time = ((float) $start_usec + (float) $start_sec); socket_send($socket, $package, strlen($package), 0); if(@socket_read($socket, 255)) { list($end_usec, $end_sec) = explode(" ", microtime()); $end_time = ((float) $end_usec + (float) $end_sec); $total_time = $end_time - $start_time; $great = "Working !!"; return $total_time." - ".$great; } else { return false; } socket_close($socket); } ping("127.0.0.1"); when I use the function it passes back to the same page I need it to send to this page server.php error_reporting(E_ALL | E_STRICT); $socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); socket_bind($socket, '127.0.0.1', 1223); $from = "127.0.0.1"; $port = 80; socket_recvfrom($socket, $buf, 12, 0, $from, $port); echo "Received $buf from remote address $from and remote port $port" . PHP_EOL; I really need help with this. Thanks
  6. Hi, I have this code that works fine, the problem is the code only works if Im adding numbers $sum = "1 + 1 + 1"; function str2num($Str) { $numTotal = 0; if ( $Nums = explode('+', $Str) ) { foreach ( $Nums as $Num ) $numTotal += $Num; return $numTotal; } else return 0; } print(str2num($sum)); I need this to work for any type of sum like: $sum = "1 + 1 + 5 - 2 * 2"; please help Thanks !
  7. Hi, Im still getting used to regex and I need some help could someone show me how to match javascript like : <script type="text/javascript"> function one(){ code.... } </script> how can I match this in html code ? I'm reading a file into a string I want to then find if theres javascript in the code and remove it ? Im using this to read the file: $html = file_get_contents("test.html"); Please help !
  8. Hi, Im using this code to read a robot.txt file then add all the disallowed file and directories to an array $filename = "robots.txt"; $disallows = array(); $handle = fopen($filename, "rb"); $contents = fread($handle, filesize($filename)); preg_match_all("/Disallow:\s*(.+)/im", $contents, $foo); $disallow = $foo[1]; while(list($key, $value) = each($disallow)){ print $value. "<br />"; } fclose($handle); Now what i want to do is pass a link then check if the link or part of the link is in the array like: if(in_array("http://www.site.com/disallowedDir/", $disallow)){ //Skip link }else{ //do something cause link is not in array } I need to know how to do this thanks
  9. Hi, I know how to use this to get meta tags the problem is sometimes it takes long to fetch meta tags and then I get a message saying: Maximum execution time of 60 seconds exceeded.. my code... $metatags = @ get_meta_tags($url); $title = $metatags["title"]; $description = $metatags["description"]; $keywords = $metatags["keywords"]; Thanks
  10. Pro.Luv

    Question

    Hi, I'm running a query from the my database, each time the query loops it fetch's an address then goes to that address and gets all the links from that address.. problem is after a few addresses it stops is this a database problem ? do I have to give the query a break inbetween ? I need this query to be running at all times Thanks
  11. hi ngreenwood6, it is counting if you check: if ($_GET["pgnum"] == $cpgnum){ print "<a href=\"$PHP_SELF?offset=$newoffset&pgnum=$cpgnum&pages=$pages\" $active $active1><b>$cpgnum</b></a> | "; } else { print "<a href=\"$PHP_SELF?offset=$newoffset&pgnum=$cpgnum&pages=$pages\" $active $active1>$cpgnum</a> | "; } } //COUNTING HERE $count++;
  12. Hi, I have this code that I need help with its something like a pagination: <? $pages = 20; $limit = 10; $count = 0; if (strlen($_GET["pgnum"]) == 0 OR $_GET["pgnum"] == 1){$disablePrevious = "disabled"; } else { $disablePrevious = ""; } $nextpagePrevious = $_GET["pgnum"] - 1; print "<a href=\"$PHP_SELF?offset=$limit&pgnum=$nextpagePrevious&pages=$pages\" style=\"text-decoration:none\" <input type=\"button\" value=\"< Previous\" $disablePrevious></a> "; for ($i=1;$i<=$pages;$i++) { $newoffset=$limit*($i-1); $cpgnum = $i; if ($pages > 1) { //REMOVE TO PRINT 20 links if ($count == $limit){ print "... "; break; } if ($_GET["pgnum"] == $cpgnum){ print "<a href=\"$PHP_SELF?offset=$newoffset&pgnum=$cpgnum&pages=$pages\"><b>$cpgnum</b></a> | "; } else { print "<a href=\"$PHP_SELF?offset=$newoffset&pgnum=$cpgnum&pages=$pages\">$cpgnum</a> | "; } } $count++; } if ($_GET["pgnum"] AND $_GET["pgnum"] == $_GET["pages"]){$disableNext = "disabled";} else{$disableNext = "";} $nextpage = $_GET["pgnum"] + 1; print "<a href=\"$PHP_SELF?offset=$limit&pgnum=$nextpage&pages=$pages\" style=\"text-decoration:none\"><input type=\"button\" value=\"Next >\" $disableNext></a>"; ?> what this code basically does is print out 10 links this code: if ($count == $limit){ print "... "; break; } checks if $count is equal to limit and at the top you see $limit is set to 10.. so it only prints out 10 links if you remove the code above it will print 20 links.. I want to only show 10 links then when the 10th link is shown I want show the 11th link then 12th like before 10th link is reached: 1,2,3,4,5,6,7,8,9,10 after 10th link is reached 2,3,4,5,6,7,8,9,10,11 and so on.. The 1 goes away and the 11th link shows. Really need help with this! thanks
  13. thanks premiso will read up on it, thanks for all the help!!
  14. I'm sorry if I'm confusing you ted_chou12 really am great full for your help.. I'm trying to Define a named constant..
  15. It's PHP... When you use define and you want to change a word say for example: welcome.. it would be define("welcome","Welcome User !"); echo welcome; // gives you Welcome User ! echo "welcome"; //gives you welcome, no change
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.