Tags: curl

Sort by: Date / Title /

  1. 3 years ago by cyo
    1. Ici on récupère les tweets du compte "NouveauLivre" (http://twitter.com/NouveauLivre), on filtre sur la ligne "<description>" et on utilise une expression régulière qui "match" les liens bit.ly pour Amazon (http://amzn.to/).
    2.  
    3. curl http://twitter.com/statuses/user_timeline/67956966.rss | grep '<description>' | sed -rne "s_.*(http://amzn.to/[a-zA-Z0-9]*).*_1_p"
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2117"></script>
  2. 3 years ago by cyo
    1. curl -I http://bit.ly/aBcDeF | grep '^Location: ' | awk '{ print $2; }'
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2116"></script>
  3. 4 years ago by spirit
    1. echo '<methodCall> <methodName>something</methodName> <params>  <param>  <value>  <int>12345</int> </param> </params> </methodCall>' | curl -X POST -H 'Content-type: text/xml' -d @- https://domain.com/foo
    2.  
    3. # -X tells to use POST method
    4. # -H is used to add custom header
    5. # @- is used to read from stdin (ie echo)
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2008"></script>
  4. sponsorised links
  5. 6 years ago by fandelost
    1. <?php
    2. class cpanel
    3. {
    4.     /** 
    5.     * @var        resource        contains curl resource for communication with cpanel 
    6.     **/
    7.     var $socket ;
    8.     /**
    9.     * @param    string            username          your cpanel username
    10.     * @param    string            password          your cpanel password
    11.     * @param    string            hostname          your cpanel hostname
    12.     * @param    bool            ssl                  indicate ssl availability
    13.     * @param    string            theme              indicate the theme being used
    14.     * @return    void
    15.     *
    16.     * This will give you the default settings of using ssl and X as the theme
    17.     * <code><?php $cpanel = new cpanel( 'username', 'password', 'hostname' ); ?></code>
    18.     * 
    19.     * This will allow you to disable SSL
    20.     * <code><?php $cpanel = new cpanel( 'username', 'password', 'hostname', false ); ?></code>
    21.     * 
    22.     * This will allow you to disable SSL and change the theme
    23.     * <code><?php $cpanel = new cpanel( 'username', 'password', 'hostname', false, 'mytheme' ); ?></code>
    24.     **/
    25.     function cpanel( $username, $password, $hostname, $ssl = true, $theme = 'x' )
    26.     {
    27.         $this->ssl = $ssl ;
    28.         $this->username = $username ;
    29.         $this->password = $password ;
    30.         $this->hostname = $hostname ;
    31.         $this->request = $request ;
    32.         $this->theme = $theme ;
    33.          
    34.         if( !( $this->socket = @curl_init( ) ) ): die('FATAL : Cannot initialize curl');
    35.             return;
    36.         else:     
    37.             if( $this->ssl ):
    38.                 curl_setopt( $this->socket, CURLOPT_SSL_VERIFYPEER, 0 );                 
    39.                 curl_setopt( $this->socket, CURLOPT_SSL_VERIFYHOST, 0 );
    40.             endif;
    41.              
    42.             curl_setopt( $this->socket, CURLOPT_FOLLOWLOCATION, 1 );
    43.             curl_setopt( $this->socket, CURLOPT_HEADER, 0 );
    44.             curl_setopt( $this->socket, CURLOPT_RETURNTRANSFER, 1 );
    45.             curl_setopt( $this->socket, CURLOPT_HTTPHEADER, 
    46.             array( sprintf( "Authorization: Basic %s", base64_encode( sprintf( '%s:%s', $this->username, $this->password ) ) ) )
    47.             );
    48.         endif;     
    49.          
    50.         if( ereg( 'Login Attempt Failed', $this->make_request( sprintf( '/frontend/%s/', $this->theme ) ) ) )
    51.             die("Cannot login to cpanel");
    52.     }
    53.     /**
    54.     * @param    string            request            the page to retrieve from cpanel
    55.     * @return    string            returns raw data
    56.     *
    57.     * This would retrieve the index page from cpanel
    58.     * <code><?php $cpanel->make_request( "/frontend/$cpanel->theme" ); ?>
    59.     **/
    60.     function make_request( $request )
    61.     {
    62.         if( $this->ssl )
    63.             curl_setopt( $this->socket, CURLOPT_URL, sprintf( "https://%s:2083%s",$this->hostname$request ) );
    64.         else
    65.             curl_setopt( $this->socket, CURLOPT_URL, sprintf( "http://%s:2082%s",$this->hostname$request ) );
    66.          
    67.         return curl_exec( $this->socket );
    68.     }
    69.     /**
    70.     * @return    string            returns html tables of table from cpanel index
    71.     *
    72.     * This example method returns all your account information from cpanel index, unformatted
    73.     * <code><?php echo $cpanel->account_tables( ); ?></code>
    74.     **/
    75.     function account_tables( )
    76.     {
    77.         preg_match_all( '#(<table width="275" border="0" cellspacing="3" cellpadding="4">.*?[^<]</table>)#si'
    78.                         $this->make_request( sprintf( "/frontend/%s/", $this->theme ) )
    79.                         $return 
    80.         );
    81.         return implode( "<br />", $return[0] );
    82.     }
    83.     /**
    84.     * This method closes the curl resource
    85.     *
    86.     * <code><?php $cpanel->_close( ); ?></code>
    87.     **/     
    88.     function _close( )
    89.     {
    90.         return @curl_close( $this->socket );
    91.     }
    92. }
    93. $cpanel = new cpanel( "username", "password", "hostname" );
    94.  
    95. echo $cpanel->account_tables( );
    96.  
    97. $cpanel->_close( );
    98. ?>
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/1011"></script>

First / Previous / Next / Last / Page 1 of 1 (4 posteets)