Jump to content

benphp

Members
  • Posts

    336
  • Joined

  • Last visited

Everything posted by benphp

  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 }
×
×
  • 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.