How to save a .gif in Classic ASP – converting from PHP script – options for fopen, fwrite

I have this very tiny php script which does exactly what I need – I need to convert it to classic ASP however. I have googled but been unable to find information on anything similar to ‘fopen’ or ‘fwrite’ in classic ASP.

My original PHP Script is:

$responseImg = file_get_contents("");
$fp = fopen("/my/server/public_html/mydirectory/samepicture.gif", "w");
fwrite($fp, $responseImg);

Really short, really simple and does just what I need. It makes a call to an API that returns a gif. I save the gif on my local server and a cron-job runs the script every so often to keep the gif up to date.

I’m moving to an IIS server which does not have php on it, so classic ASP will have to suffice.

I’ve gotten this far:

url = ""
set xmlhttp = server.CreateObject("Msxml2.ServerXMLHTTP.6.0") "GET", url, false 
xmlhttp.send "" 
Response.write xmlhttp.responseText 
set xmlhttp = nothing 

I was able to put that together from some other stuff online.

I just need to figure out how to save the gif that will be returned on the server – then I will setup scheduled tasks to run it on an interval.

Any help appreciated.


Search Google Shopping products PHP

Is it possible, using Google’s API or merely faking a request to retrieve the products from a google shopping search query ? For example :

I would like to retrieve all the results for the following query, trying to fake a request resulted me in an empty page as it seems like it makes a weird AJAX request to Google’s API which I cannot parse.
Is there something similar to
for example ?

Phpmailer security holes

Is there any security holes in my code? I want to be sure before as I feel there might be some kinda exploit I may not be aware of. Basically, I’m trying to setup a contact form using phpmailer. Newbie here. Thanks for the help

$name = $_POST['name'];
$email = $_POST['email'];
$brand = $_POST['brand'];
$type = $_POST['type'];
$message = $_POST['message'];
$formcontent=" From: $name \n Email: $email \n Brand: $brand \n Type: $type \n Message: $message";


$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
$mail->IsSendmail(); // telling the class to use SendMail transport
$mail->setCharset = "UTF-8";
try {
  $mail->AddReplyTo($_POST["email"], $_POST["name"]);
  $mail->SetFrom($_POST["email"], $_POST["name"]);
  $mail->AddReplyTo($_POST["email"], $_POST["name"]);
  $mail->Subject = 'Home page contact form';
  $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
  $mail->Body = str_replace( "\n", '<br />', $formcontent );
  if(is_array($_FILES)) {
} catch (phpmailerException $e) {
  echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
  echo $e->getMessage(); //Boring error messages from anything else!

Copy Files with PhpCopy function Not Working

I am trying to copy files from external server to my server with PhpCopy Function, But it’s not working when I select destination path from mysql and when I enter that path manually to the script then it works perfect, so problem is script not getting exact path from database. I am adding my code below, please try to solve it.


$id = $_GET['id'];
$folder_info = mysql_fetch_array(mysql_query('SELECT `path`, `name` FROM `folders` WHERE `id` = '.$id));


<form enctype='multipart/form-data' action='phpcopy.php?dldn=true' method='post'>
<tr><td><b>From (http://)<b>:</b></font> <input type=text name='from' size=58></td><td><b>To Name</b> <b>:</b></font><input type=text name='to' size=58></td></tr>
<select name="method">
    <option value="copy">PHPCopy</option>
</td><td><input type=submit value='Submit Form'></td></tr></table>


$folder = $folder_info['path'];

if ($_GET[dldn]){  

            $from = $_POST[from];

            if ($_POST[to] == "")
               $to = basename("$from");
            else $to = $_POST[to];

            $to = str_replace('%20',' ',$to);

            $down = "$folder/$to";

            $method = $_GET['method'];

                if (!copy($_POST['from'],$down))
                   echo '<p align="center">Failed to copy file</p>';

$size = round((filesize("$down")/(1024 * 1024)), 3);

if (!$_POST[from] == "")
echo "$to $size Uploaded";
} ?>

And when I try

echo $folder_info[‘path’];

then it shows the correct folder where I want to copy files. Please guys Show me exact way to go with.

Drupal: db_query needs to be array and able to group by certain value

I am writing the following code for a query:

$var = db_query('blah')->fetchAllAssoc('someColumn');

This will result in the following data. I don’t or can’t see exactly how its organized as I can’t echo this anywhere easily. I know this is what will be returned because query has been tested elsewhere.

 col1    someColumn
 21      sameValue
 22      sameValue
 24      sameValue

I want to take $var and make it into an array like:

{ 'sameValue' => {21,22,24} }

Please show code and a small explanation.

Magento currency ins not converting and in all websites still the same

I have one magento server with three websites, every website has efferent language and currency.

The base currency was Danish Krone "DKK" , and the three website has its own currency like DKK, SEK and NOK. I have imported the rates and configured the scope to "Websites" but it doesn’t seem to be working. When I enter each website it says for ex: 1899DKK and same product in the other website says 1899NOK. The rates were imported.

I have setup prices rounded to nearest (49 and 99 but does it have to be a part of problem.

note ” all websites have its own domain name”.

UPDATE : I have noticed a prices converted when added to cart, but when i brows the website still the prices wrong.

How can I check if a data table field is null in CodeIgniter?

I’ve got the following magic __get function in my MY_Model class (which extends the CI_Model class) :

public function __get($field){  
    $row = $this->freshData ? $this->freshRow() : $this->staleRow();
    return (isset($row) && array_key_exists($field, $row) ? $row[$field] : parent::__get($field));

For the sake of simplicity, we’re going to say that $this->freshData is true, and just look at the $this->freshRow() function :

 * Returns a row of fresh data.
private function freshRow(){
    if (!isset($this->database)){ return; }
        return $this->database->get_where($this->table, "$this->idKey = $this->ID")->first_row('array');

Again, please, let us assume that $this->database is set and valid, as are the $this->table, $this->idKey, and $this->ID fields (because they are and we don’t need to go there).

I am running this model against a table in which there resides a Date field which can be null for reasons. I need to know when this field is null because if it IS null, there are some input fields in the view which need to be left blank (or populated with another value).

Unfortunately, for some reason, I can’t get the program to recognize the return value as NULL when the database field is null, so what I end up with is this –

<?php $PromoEnds = !is_null($Features->Date_PromoEnds) //$Features is model which extends MY_Model.
        ? strtotime($Features->Date_PromoEnds) //This ALWAYS GETS HIT and I end up with 1/1/1970!!!
        : NULL; //This NEVER GETS HIT!!! ?>

$PromoEnds should be null if $Features->Date_PromoEnds is null, but it’s not. It always gets set to the start of the Unix Epoch. $Features->Date_PromoEnds is null for every row in the table.

What am I doing wrong here???

chrome loads my page, firefox doesn’t

I’m trying to echo php in a web page via an HTML form (test_form.php –> test.php). The form allows users to pick a date and time. I’ll show the code for test_form.php and test.php below.

This works in Chrome (linux) — my script checks that the date and hour are set, then echoes the date and hour in the browser.

But it doesn’t work in Firefox (linux) or Safari (Mac).

In Firefox, I get a blank page. When I view the page source I see the echoed stuff — except it tells me that date and hour are NOT set!

Has anyone experienced this? Does anyone have an idea what’s going on?

thanks in advance.


error_reporting(E_ALL | E_NOTICE);
ini_set('display_errors', '1');
<!DOCTYPE html> 

    <meta charset='utf-8'>
    <meta name='viewport' content='width=device-width, initial-scale=1'> 
    <title>Select date a d/or time</title> 
    <link rel='stylesheet' href=''>
    <link rel="stylesheet" href="" />
      ajaxEnabled: false

 function checkForm(form)
    // validation fails if the input is blank
    if(form.hour.value == "") {
      alert("Error: Please select an hour!");
      return false;

    // regular expression to match only digits (0-24)
    var re = /0|(0[1-9])|(1[0-9])|(2[0-4]))/;

    // validation fails if the input doesn't match our regular expression
    if(!re.test(form.hour.value)) {
      alert("Error: Input contains invalid characters!");
      return false;

    // validation was successful
    return true;



Back Date/time
<!-- /collapsible --> <!-- /collapsible --> <ul data-role='listview'> <li><a href='Manymonth_form.php' data-rel='dialog'>Monthly</a></li> <li><a href='Manyyear_form.php' data-rel='dialog'>Yearly</a></li> </ul> </div><!-- /collapsible set --> </div><!-- /popup -->
Select a date and hour
</div><!-- /page --> </body> </html>

… and test.php:

error_reporting(E_ALL | E_NOTICE);
ini_set('display_errors', '1');

if(isset($_POST['date'])){$date = $_POST['date'];$date = str_replace("-","",$date);echo "date IS set, and it is ".$date."<br>";} else {$date = "20150101"; echo "date variable not set";}
if(isset($_POST['hour'])){$hour = $_POST['hour']; echo "hour IS set! And it is ".$hour."<br>"; if($hour == "00"){$hour =24;}} else {$hour = "01"; echo "hour variable is not set";}


Invalid merchant information: 10002-You do not have permissions to make this API call

I am facing some issue with Paypal payment gateway integration.

My live site transaction are working fine and payment has approved but test mode payment return following error message

Invalid merchant information: 10002-You do not have permissions to
make this API call

I am using follow URL for the send the request on the test or live mode

if ($this->test_mode == 1) {

     $this->submiturl = '';
    $this->submiturl = '';

I have update the Manager account details by following steps

Business Pro sandbox account in your manager account under “Service Settings –> Set Up –> PayPal Sandbox Email address”.

Could you please help me on this issue.


Laravel 5 Validation – error class on form elements

My validation form works fine and it looks like this:

{!! Form::email('email', null, array('placeholder' => 'Email', 'class' => 'form-control ')) !!}

If the email is not good, I get this error: The a email has already been taken.

The thing is that I wan’t to put a css class on the input also like error in order to add a red background border to the input.

How can I do this?