在我创建的php字符串中有一个随机行

在我创建的php字符串中有一个随机行

问题描述:

I am working on a small app that uses the shareaholic API in PHP. I created a small function that will cunstruct the correct url. When the string is returned it returns it with a line break after the v. Output below:

http://www.shareaholic.com/api/share/?v=1&apitype=1&apikey=#################################&service=5&link=http://website.com/contest-page/&title=Website&notes=I+voted+for+Example5%27s+photo+to+win

So the browser only gets the url up to the /?

here is the php

function createShareToLink($serv, $name){
    $sharebase = 'http://www.shareaholic.com/api/share/?v=1';
    $apitype = "&apitype=1";
    $apikey = "&apikey=redacted";
    $twitter = false;

    $title = trim("redacted");
    $title = urlencode($title);
    $url = "http://redacted.com/contest-page/";
    $msg = urlencode("I voted for $name's photo to win");


    switch($serv){
        case 1: //facebook
            $service = "&service=5";
            break;
        case 2: //twitter
            $twitter = true;
            $service = "&service=7";
            break;
        case 3: //Google        
            $service = "&service=304";
            break;
        default:
            $service = "&service=5";
            break;
    }

    if(!$twitter){
        $shareurl = $sharebase . $apitype . $apikey . $service . '&link=' . $url . '&title=' . $title . '&notes=' . $msg;
    } else {
        $shareurl = $sharebase . $apitype . $apikey . $service . '&link=' . $url . '&title=' . $title . '&template=redacted.com%20100lbs%20BBQ%20Giveaway%20${short_link}%20via%20@redacted%20%23Contest%20%23Giveaway';
    }

    return $shareurl;
}

I have never run into this, any ideas? Output displayed in WordPress Into a HTML form, I can see the entire link, but it breaks right after the ? which is that is passed to the browser on click. Also shareaholic api returns that all info is null.

Ok this is odd to me, but I got it working and that is all that matters I was using this:

echo '<form action="' . $fblink . '" target="_blank" method="get"><input type="submit" id="fblink"></form>';

Which would send only the fist part, like I mentioned above.

I changed it to a div wrapped link and it works fine now. I don't really know why the other way wouldn't work but it works now so whatever.

Thanks everyone.