Jump to content

jairathnem

Members
  • Posts

    93
  • Joined

  • Last visited

Everything posted by jairathnem

  1. not sure what you are trying to do here.
  2. 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"))
  3. 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).
  4. there is your problem. $imgs isn't holding any data. check how it is generated.
  5. how is value stored to $imgs? do a var_dump($imgs) before the foreach loop and check if it holds any data.
  6. Look at the example carefully. You missed: 1. Colon at end of if statement and at end of elseif statement. 2. You missed the endif; statement at the last.
  7. 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; ?>
  8. use GET or POST request to transfer the selected field over to other page.
  9. mysql_fetch_row fetches a single row. use mysql_fetch_assoc instead of that. Even better suggestion - move to PDO instead of mysql.
  10. 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); ?>
  11. wow. I didn't know that would work! thanks!
  12. 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.
  13. 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'];
  14. you missed the important line - $data = json_decode($response,true); check my previous post!
  15. $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']
  16. <form action="#" method="POST"> action is blank here.
  17. for force download you should set Content-Type: application/octet-stream looks like you change it if its txt, hence it is displaying and not downloading.
  18. 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)
  19. is your URL something like this - about.php?page=somevalue ? if not, it should be like that cause you are accessing the page value in your page. read up on GET and POST requests.
  20. check : https://www.setcronjob.com They have a free service with upto 50 cron jobs/day.
  21. static variable. doesn't make sense, does it?
  22. That is JSON output. use json_decode to get the data into an array. sample: $data = json_decode($response); $data is an array containing values of $response.
  23. you may want to check out http://kb.mozillazine.org/Filenames_with_spaces_are_truncated_upon_download
  24. Since the API returns XML shouldnt it be something like this json_decode(json_encode((array)simplexml_load_string($xml)),1);
×
×
  • 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.