Login   Register  
PHP Classes
elePHPant
Icontem

File: gHttp.test.trackback.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Cesar D. Rodas  >  gHttp  >  gHttp.test.trackback.php  >  Download  
File: gHttp.test.trackback.php
Role: Example script
Content type: text/plain
Description: Test of POST query...
Class: gHttp
Stream wrapper to send HTTP POST and GET requests
Author: By
Last change:
Date: 2007-07-28 16:50
Size: 1,847 bytes
 

Contents

Class file image Download
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
    background-color: #E8E8E8;
    font-family:Arial, Helvetica, sans-serif;
    font-size:13px
}
-->
</style></head>
<body>
<h1 align="center">Testing Cesar D. Rodas gHttp</h1>
<h2 align="center">phttp (post query)</h2>
<p>This code do a Post query, and in this example to a <strong><em>Trackback </em></strong>to my web site, please, don't use this code to do spam to others blogs, this is only a test.</p>
<hr>
<p>
  <?php
/*
**    This example show how to do a trackback test.
**    Do not use for spam. This is only a test of use phttp (Post Http)
**    with gHttp.
*/
include('../http.php');
include(
'../gHttp.php');

/*
#Examples of how to user this class with a proxy
$proxy['host']="proxy.host.com";
$proxy['port']="3128";
$proxy['user']="user";
$proxy['pass']="password";
$proxy['realm'] ="proxyrealm" ;
$proxy['mech']="";  #Proxy proxy_authentication_mechanism
*/
$gPost = array(
    
'title' => 'gHttp Trackback test '.date("Y-m-d H:i:s"),
    
'url' => 'http://test1.com/',
    
'blog_name' => 'This is my blog',
    
'excerpt' => 'Hello'
);
        
$f fopen("phttp://localhost/cesarodas/wp-trackback.php?p=40","r"); 
if (
$f === false) {
    print 
"Error while trying to do the trackback. Error message: <strong>${gHttpErr}</strong>";
    exit;
}

print 
"<pre><b>Response headers</b>\r\n".print_r($gHeaders,true)."\r\n\r\n<strong>Response Text</strong>\r\n";
while ( 
$body fread($f1024) ) 
    print 
htmlentities($body);
print 
"</pre>";
fclose($f);
?>
  </h2>
</p>
<hr>
Cesar D. Rodas
</body>
</html>