cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Transferring open-Id Info to Google apps script through CURL to run app script in the background

From: Steve Penn <spenn_at_omniis.com>
Date: Wed, 18 Sep 2013 11:00:13 +0100

Hi,

I'm working on an issue where i need to take the information from the users
own login to my application (through open-id) and send this through to a
google apps script,

I'm pretty sure i shouldn't be able to do this, but if it's a possibility
then it would benefit me greatly,

When i try to use curl the response sent back from the script is a google
login page for the drive area, this i thought was strange in itself, to
debug this I checked the url I was sending on both a browser window in
which I was logged into an account, and again with one that wasn't, the url
without the logged in browser gave me the login page but the other sent me
to the script,

I believe it isn't possible to send the information across, but it seems
that the curl is acting as it's own browser,

I'm quite new to cURL so i'm not too sure how to go about this issue,

Here is what i have in terms of the cURL POST:

$url="https://script.google.com/macros/s/XXXXXXXXXXXXXXXXXXXXXXXX/exec";
//[url of script]

 $datatopost = array(
"tenant_id" => $tenant['id'],
 "start" => $start,
"duration" => $duration,
"fee" => $fee,
 "deposit" => $deposit,
"agdate" => $agreedate,
"notice" => $notice,
 "commencement" => $commencement,
"randgen" => $randgen,
 "company" => $tenant['name'],
"addressone" => $tenant['address_one'],
 "addresstwo" => $tenant['address_two'],
"firstname" => $tenant['firstname'],
 "secondname" => $tenant['lastname'],
"suite" => $suite,
 "telephone" => $tenant['contact_no'],
"building" => $buildcen['building'],
 "description" => $provisions
);

 $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
 curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
 curl_setopt($ch, CURLOPT_POSTFIELDS, $datatopost);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 $returnData = curl_exec($ch);
 curl_close($ch);
 print $returndata;

Thank you for your time,

Stephen Penn.

--
Helpdesk: 01594 372 010
Developer Line: 01594 888 136
Email: spenn_at_omniis.com
[image: Omniis]
*TECHNOLOGY FOR SHARED SPACES*
*www.omniis.com <http://www.omniis.com%20/> and www.babblevoice.com**
*

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

image001.jpg
Received on 2013-09-18