Jump to content

benphp

Members
  • Posts

    336
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

benphp's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. CURL is a dll on my Windows server - I don't know how to run that from CMD - unless I download the standalone curl.exe. If I wait half an hour or so I finally get an error from fie_get_contents: Warning: file_get_contents(http://www.google.com) [ function.file-get-contents]: failed to open stream: 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. My intuition is that there's some server or network setting that is denying the HTTP request from the server.
  2. I can use both file_get_contents and CURL to fetch the contents of a file on my server, but when I attempt to read a file from outside the server, both just spin forever, never reading the file. I'm on IIS7 - and Curl is installed and running. I can browse to the locations with no trouble, but if I attempt to fetch the files using PHP, I get nothing. Is there some other setting in IIS that I need to enable or disable? What am I missing? Neither works: $sourceLink = "http://www.google.com"; $sourcePageHTML = file_get_contents($sourceLink); print $sourcePageHTML; $ch = curl_init("http://www.google.com"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); $data = curl_exec($ch); print($data); Both work: $sourceLink = "http://myserver/myfile.php"; $sourcePageHTML = file_get_contents($sourceLink); print $sourcePageHTML; $ch = curl_init("http://myserver/myfile.php"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); $data = curl_exec($ch); print($data);
  3. OK -thanks! Yes, that works. But what if I did this: SELECT Courses.CourseTitle, Events.EventDate FROM Courses LEFT JOIN Events on (Events.CID = Courses.CID) Distinct wouldn't work, right?
  4. I want to fetch the titles from the Courses table, but I only want the Course Title to return once when I join Events. Courses CID | CourseTitle 1 | Course A 2 | Course B 3 | Course C Events EID | CID | EventDate 1 | 1 | 2016-02-22 2 | 1 | 2016-02-23 3 | 2 | 2016-02-24 4 | 3 | 2016-02-25 5 | 3 | 2016-02-26 If I use a JOIN, SELECT Courses.CourseTitle FROM Courses LEFT JOIN Events on (Events.CID = Courses.CID) then I get Course A Course A Course B Course C Course C But what I want is Course A Course B Course C Because ultimately, I'm going to select an Event date range, and I want to see just the courses with the event date range. Thanks!
  5. I found the trouble. I'm using Notepad++, and I replaced all carriage returns with new line (replaced \r with \n). I'm not sure how the \r got in there.
  6. This is new. For some reason, the PHP errors are not counting my //commented lines. Example: <?php //my comment : ?> Parse error: syntax error, unexpected ':' in D:\www\myscript.php on line 2 The error is on line 3. If I add more comments, the error is the same: <?php //my comment //my comment //my comment //my comment //my comment : ?> Parse error: syntax error, unexpected ':' in D:\www\myscript.php on line 2 Where is this setting? Thanks.
  7. I wrote a text encryption function that uses a combination of looped base64_encode, mcrypt_encrypt, and random-ish str_replace that produces a fairly meaningless chunk of text. How strong is this encryption? For example, how long would it take for the Chinese government to crack it?
  8. Strange behavior - so when I hover over the link in the Outlook email, the url shows all lower case. But if I click the link, it goes to the right web page with correct upper/lowercase text.
  9. $strEvalLink = "<p><a href='http://myserver/evals.php?CLID=3717&INID=93' target='_NewEval'>Please click here to fill out the evaluation for Test</a>.</p><p>Your feedback is important to us.</p><p>Thank You!</p>"; $headers = "Message-ID: <". time() .rand(1,1000). "@".$_SERVER['SERVER_NAME'].">". "\r\n"; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; $headers .= "$from_email" . "\r\n"; mail($to_email, $strEmailSubject, $strEvalLink, $headers); The result is an email with the link to: http://myserver/evals.php?clid=3717&inid=93 I even print the HTML on the page after sending the mail, and the HTML shows the correct Uppercase values.
  10. For example, can I do: if ($test == "yes") $myOp = ">"; } else { $myOp = "<"; } I know this doesn't work, but is there a way to do this with curly brackets? And then: if (($img == "0" && $textCount $myOp 1000) || $img == "") { //do this }
  11. PHP v5.2.17 IIS v7.5 I have a script that hits a MS SQL db that is authenticated via Windows. If I run the script on the local server (localhost for example), it recognizes my Windows logon and passes the logon to MS SQL Server and all is well. However, when I run the page from another PC, the script fails with: "Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON' ". I have the page Authentication set so Anonymous Authentication is Disabled, and Windows Authentication is Enabled. This is the correct setting. I know. So why is it that the server isn't authenticating me via the web and passing along the authentication "impersonating" me for MS SQL? I've tried setting fastcgi.impersonate to 0, but that doesn't help at all. Here's my PHP.INI settings: default_socket_timeout = 60 upload_tmp_dir="C:\Windows\Temp" session.save_path="C:\Windows\Temp" error_log="C:\Windows\temp\php-errors.log" cgi.force_redirect=0 fastcgi.impersonate=1 fastcgi.logging=0 cgi.fix_pathinfo = 1 Any tips, help appreciated!
  12. Using mssql_query to hit a MS SQL db that has a table with "ntext" as the datatype for "MLTEXT" SELECT MLID, CAST(MLTEXT AS TEXT ) FROM ANSWER WHERE NID = 1201 Returns only 110 chars of the MLTEXT. I tried modifying the PHP.INI file to set the max text length, but that didn't seem to make a difference. I tried: ini_set ( 'mssql.textlimit' , '2147483647' ); ini_set ( 'mssql.textsize' , '2147483647' ); mssql_query("SET TEXTSIZE 2147483647"); as well, but still the same results. Is there a better way to fetch the data? Is it the db that's limiting the text length? Thanks -
  13. This is an easy one for you masters. I find it a PIA - http://myserver/calendar/events.php I want: http://myserver/calendar/ or http://myserver/calendar ?
×
×
  • 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.