Jump to content

ted_chou12

Members
  • Content Count

    1,488
  • Joined

  • Last visited

Community Reputation

0 Neutral

About ted_chou12

  • Rank
    Prolific Member

Contact Methods

  • Website URL
    http://www.netfriending.co.cc

Profile Information

  • Gender
    Male
  • Location
    @ Mars
  1. ted_chou12

    Rewriting as php curl

    [[ TOKEN, DOMAIN1, and DOMAIN2 are redactions --requinix ]] Hi, I have a piece of code that I can execute with bash curl without problem: mac70:gsuite_automate ted.chou$ curl -H "Authorization: OAuth TOKEN" https://apps-apis.google.com/a/feeds/domain/2.0/DOMAIN1/sso/general -v * Trying 64.233.187.118... * TCP_NODELAY set * Connected to apps-apis.google.com (64.233.187.118) port 443 (#0) * TLS 1.2 connection using TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 * Server certificate: *.google.com * Server certificate: Google Internet Authority G2 * Server certificate: GeoTrust Global CA > GET /a/feeds/domain/2.0/DOMAIN1/sso/general HTTP/1.1 > Host: apps-apis.google.com > User-Agent: curl/7.51.0 > Accept: */* > Authorization: OAuth TOKEN > < HTTP/1.1 200 OK < Content-Type: application/atom+xml; charset=UTF-8 < Expires: Tue, 24 Jan 2017 13:20:21 GMT < Date: Tue, 24 Jan 2017 13:20:21 GMT < Cache-Control: private, max-age=0, must-revalidate, no-transform < Vary: Accept, X-GData-Authorization, GData-Version < GData-Version: 1.0 < Last-Modified: Tue, 24 Jan 2017 13:20:21 GMT < Transfer-Encoding: chunked < X-Content-Type-Options: nosniff < X-Frame-Options: SAMEORIGIN < X-XSS-Protection: 1; mode=block < Server: GSE < Alt-Svc: quic=":443"; ma=2592000; v="35,34" < * Curl_http_done: called premature == 0 * Connection #0 to host apps-apis.google.com left intact <?xml version='1.0' encoding='UTF-8'?><entry xmlns='http://www.w3.org/2005/Atom' xmlns:apps='http://schemas.google.com/apps/2006'><id>https://apps-apis.google.com/a/feeds/domain/2.0/DOMAIN1/sso/general</id><updated>2017-01-24T13:20:21.003Z</updated><link rel='self' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/domain/2.0/DOMAIN1/sso/general'/><link rel='edit' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/domain/2.0/DOMAIN1/sso/general'/><apps:property name='enableSSO' value='true'/><apps:property name='changePasswordUri' value='https://DOMAIN2/sso/DOMAIN1/login'/><apps:property name='useDomainSpecificIssuer' value='true'/><apps:property name='samlLogoutUri' value='https://DOMAIN2/sso/DOMAIN1/logout'/><apps:property name='ssoWhitelist' value=''/><apps:property name='samlSignonUri' value='https://DOMAIN2/sso/DOMAIN1/login'/></entry>mac70:gsuite_automate ted.chou$ But I can't seem to reproduce it with the curl in PHP: $crl = curl_init(); $headr = array(); $headr[] = 'Content-length: 0'; $headr[] = 'Content-type: application/json'; $headr[] = 'Authorization: OAuth ' . $access_token; curl_setopt($crl, CURLOPT_URL, 'https://apps-apis.google.com/a/feeds/domain/2.0/DOMAIN1/sso/general'); curl_setopt($crl, CURLOPT_HEADER, true); curl_setopt($crl, CURLOPT_HTTPHEADER, $headr); curl_setopt($crl, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($crl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($crl, CURLOPT_POST, false); curl_setopt($crl, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($crl, CURLOPT_SSL_VERIFYPEER, false); $result = curl_exec($crl); curl_close($crl); echo json_decode($result);
  2. Hi, I have an output of print_r here: Google_Service_Calendar_Acl_Resource Object ( [stackParameters:Google_Service_Resource:private] => Array ( [alt] => Array ( [type] => string [location] => query ) [fields] => Array ( [type] => string [location] => query ) [trace] => Array I am wondering what is the right syntax to create the instance and set the variables? Thanks, Ted
  3. ted_chou12

    imap attachment file download

    Hello, I'm attempting to download the attachment from an message: $structure = imap_fetchstructure($mbox, $id); $message = imap_fetchbody($mbox,$id, "1"); $name = $structure->parts[1]->dparameters[0]->value; $type = $structure->parts[1]->type; ############## type if ($type == 0) { $type = "text/"; } elseif ($type == 1) { $type = "multipart/"; } elseif ($type == 2) { $type = "message/"; } elseif ($type == 3) { $type = "application/"; } elseif ($type == 4) { $type = "audio/"; } elseif ($type == 5) { $type = "image/"; } elseif ($type == 6) { $type = "video"; } elseif($type == 7) { $type = "other/"; } $type .= $structure->parts[1]->subtype; ######## Type end header("Content-type: ".$type); header("Content-Disposition: attachment; filename=".$name); The above gives the correct name, but the file itself seems to be empty, I dont know if the problem is the wrong parts[] or any other problem, thanks for the help, Ted
×

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.