• Hi folks,

    I have a GoDaddy account and found another post on here that showed these settings as a way to configure cURL:

    curl_setopt ($ch, CURLOPT_PROXY, “https://64.202.165.130:3128”);
    curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

    OK… so I get that part… but how do you use cURL for the full fsockopen and http_request?

    Here’s what I tried… it didn’t work… it may be that I have the wrong proxy, but I want someone who knows something to have a look before I start down the tech support road…

    /* All standard function stuff */
    function trackback($trackback_url, $title, $excerpt, $ID) {
    global $wpdb;
    $title = urlencode($title);
    $excerpt = urlencode($excerpt);
    $blog_name = urlencode(get_settings(‘blogname’));
    $tb_url = $trackback_url;
    $url = urlencode(get_permalink($ID));
    $query_string = “title=$title&url=$url&blog_name=$blog_name&excerpt=$excerpt”;
    $trackback_url = parse_url($trackback_url);
    $http_request = ‘POST’ . $trackback_url[‘path’] . ($trackback_url[‘query’] ? ‘?’.$trackback_url[‘query’] : ”) . ” HTTP/1.0\r\n”;
    $http_request .= ‘Host: ‘.$trackback_url[‘host’].”\r\n”;
    $http_request .= ‘Content-Type: application/x-www-form-urlencoded; charset=’.get_settings(‘blog_charset’).”\r\n”;
    $http_request .= ‘Content-Length: ‘.strlen($query_string).”\r\n”;
    $http_request .= “User-Agent: WordPress/” . get_settings(‘version’);
    $http_request .= “\r\n\r\n”;
    $http_request .= $query_string;
    if ( ” == $trackback_url[‘port’] )
    $trackback_url[‘port’] = 80;

    /* This is what I tried, using what I could decipher from other places on the ‘net */

    $ch = curl_init();
    curl_setopt ($ch, CURLOPT_PROXY, “https://64.202.165.130:3128”);
    curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt ($ch, CURLOPT_URL, $trackback_url[‘host’]);
    curl_setopt ($ch, CURLOPT_PORT, $trackback_url[‘port’]);
    curl_setopt ($ch, CURLOPT_POST, TRUE);
    curl_setopt ($ch, CURLOPT_POSTFIELDS, $httprequest);
    curl_exec($ch);
    curl_close($ch);

    /*this is the fsockopen process */

    $fs = @fsockopen($trackback_url[‘host’], $trackback_url[‘port’], $errno, $errstr, 4);
    @fputs($fs, $http_request);

    All assistance repaid with many good vibes sent your way!
    Thanks!

  • The topic ‘Using cURL instead of fsockopen on GoDaddy – help’ is closed to new replies.