Jump to content

jairathnem

Members
  • Posts

    93
  • Joined

  • Last visited

Posts posted by jairathnem

  1. issue is with the insert command.

    try something like:

    INSERT INTO kommentar (tittel, navn, tekst, tidsstempel, innleggid) VALUES (GetSQLValueString($_POST['tittel']"text"),GetSQLValueString($_POST['navn'], "text"),GetSQLValueString($_POST['tekst'], "text"),NOW(),getSQLValueString($_GET['innleggid'], "int"))
  2. I am completely new to SOAP calls in php. But I did give it a try based on help from google.

    <?php
    $client = new SoapClient("http://www.webservicex.net/globalweather.asmx?WSDL",array('proxy_host'     => "myproxy", 'proxy_port'     => 8080));
    $params = array("CountryName" => "united states");
    $response = $client->__soapCall("GetCitiesByCountry",array($params));
    
    var_dump($response);
    ?>

    and it did generate the needed output. 

    although when I changed 

    $response = $client->__soapCall("GetCitiesByCountry",array($params));

    to

    $response = $client->GetCitiesByCountry(array($params));

    It didnt work, and threw and error.This might help.

     

    (proxy setting not necessary).

  3. Look at the sample below taken from PHP manual page:

     <?php
    
    /* Incorrect Method: */
    if($a > $b):
        echo $a." is greater than ".$b;
    else if($a == $b): // Will not compile.
        echo "The above line causes a parse error.";
    endif;
    
    
    /* Correct Method: */
    if($a > $b):
        echo $a." is greater than ".$b;
    elseif($a == $b): // Note the combination of the words.
        echo $a." equals ".$b;
    else:
        echo $a." is neither greater than or equal to ".$b;
    endif;
    
    ?>
  4. you are seperating it based on ',' and storing it in $array, but for sort you are giving the string again. Hence the error.

    you should call sort($array) and not sort($numberstring)

     

    also you do not need to assign it to a variable,it sorts and stores it in the array given.

    sample below.

    <?php
    $num = "1,4,2,5,2,8";
    $array = explode(',',$num);
    sort($array);
    var_dump($array);
    ?>
  5. echo $response and see if it is holding value.

    $response = file_get_contents('http://api.nfldata.apiphany.com/developer/JSON/NewsByTeam/ARI?'.$getdata, false, $context);
    echo $response;
    $data = json_decode($response,true);
    echo $data['Content'];

    if it is printing, next check $data else issue with the api.

    $response = file_get_contents('http://api.nfldata.apiphany.com/developer/JSON/NewsByTeam/ARI?'.$getdata, false, $context);
    $data = json_decode($response,true);
    var_dump($data);
    echo $data['Content'];

    if it did check the structure of the printed array.

     

    these are basic triage methods.

  6. you gotta learn the basics first.

     

    just typing $data['content'] won't show anything.

    $response = file_get_contents('http://api.nfldata.apiphany.com/developer/JSON/NewsByTeam/ARI?'.$getdata, false, $context);
    $data = json_decode($response,true);
    echo $data['Content'];
    
  7. $response = file_get_contents('http://api.nfldata.apiphany.com/developer/JSON/NewsByTeam/ARI?'.$getdata, false, $context);
    $data = json_decode($response,true);

    JSON is added to the data as an array.

    if you want to access the 'Content' field, use $data['Content']

  8. From the example output you posted it looks like the json isnt well formed.

     

    The output should be something similar to the below:

    [{"Content":"The Cardinals have offered free agent ILB Karlos Dansby a two-year deal worth $10 million to $12 million.","NewsID":9701,"PlayerID":11658,"Source":"NBCSports.com","Team":"ARI","TermsOfUse":"NBCSports.com feeds in the RSS format are provided free of charge for use by individuals for personal, non-commercial uses. Attribution to NBCSports.com must be provided in connection with your use of the feeds. If you provide this attribution in text, please use: \"NBCSports.com\""}]

    missing a couple of characters at the end.

     

    echo $response and post it here.

     

     

    if it was correctly formed, when you var_dump $data it should output

    array (size=1)
    0 =>
    object(stdClass)[1]
    public 'Content' => string 'The Cardinals have offered free agent ILB Karlos Dansby a two-year deal worth $10 million to $12 million.' (length=105)
    public 'NewsID' => int 9701
    public 'PlayerID' => int 11658
    public 'Source' => string 'NBCSports.com' (length=13)
    public 'Team' => string 'ARI' (length=3)
    public 'TermsOfUse' => string 'NBCSports.com feeds in the RSS format are provided free of charge for use by individuals for personal, non-commercial uses. Attribution to NBCSports.com must be provided in connection with your use of the feeds. If you provide this attribution in text, please use: "NBCSports.com"' (length=280)
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.