TB sending script. What's wrong in this...

Discussion in 'PHP' started by AHA7, Jun 17, 2007.

  1. #1
    Hello,

    I am trying to make a script that sends trackback notification to blogs that support trackbacks. I have written the script below but it doesn't seem to work. I've tried it on some different blogs and it kept giving me a "403 Forbidden" error. Could someone take a look at the script below and tell me what I did wrong, please?

    $tb_url = "http://example.com/blog/post-name/trackback"; // tb URL for target post
    
    $tb_info = "url=" . urlencode("http://myblog.com/post-title") . "&title=" . urlencode("my post's title here") . "&blog_name=" . urlencode("my blog's name here") . "&excerpt=" . urlencode("quoted text from my post here");
    
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $tb_url);
    curl_setopt($ch, CURLOPT_HEADER, 1); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $tb_info);
    curl_exec($ch);
    curl_close($ch);
    PHP:
     
    AHA7, Jun 17, 2007 IP