Jump to content

vaskovasilev

Members
  • Posts

    34
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by vaskovasilev

  1. hello, i am trying to find working example for posting to a company page in Linkedin. i found some articles on stackoverflow .. but nothing: https://stackoverflow.com/questions/21788482/linkedin-company-share-api?rq=1 after authenticating, nothing is happening. i asked Linkedin also, but they didnt hepled me. can you please help me.. function posttopage($method, $resource, $body = '') { //$params = array('visbility' => array('code' => 'anyone'),'comment' => "php test post",'content' => array('submitted-url' => 'webcv', 'title' => 'Test Share with Content' , 'description' => 'content description' , 'submitted-image­url' => 'http://domain/logo.png'),'oauth2_access_token' => $_SESSION['access_token'],'format' => 'json'); //$params = array('visibility' => array('code' => 'anyone'),'comment' => "php test post", 'share-target-reach' => array('share-targets' => array('share-target' => array('code' => 'geos' , 'tvalues' => array('tvalue'=> 'test body for posting'))))); //print_r($params); //echo "<br><br>".json_encode($params); $strShare = <<<XML <share> <visibility> <code>anyone</code> </visibility> <comment>comment share!</comment> <content> <submitted-­url>http://www.domain</submitted-­url> <title>test share from php</title> <description>description</description> <submitted‐image-­url>http://www.domain/logo.png</submitted-­image-­url> </content> <share-target-reach> <share-targets> <share-target> <code>geos</code> <tvalues> <tvalue>IT</tvalue> </tvalues> </share-target> </share-targets> </share-target-reach> </share> XML; //$params = http_build_query($params); //$data_len = strlen ($params); //$url = 'https://api.linkedin.com' . $resource .'?'. $params ; $url = 'https://api.linkedin.com' . $resource ; //$context = stream_context_create( //array('http' => //array('method' => $method, //) //) //); //$response = file_get_contents($url, false, $context,$data_len); //return json_decode($response); //echo $url; $objCurl = curl_init(); curl_setopt($objCurl, CURLOPT_URL, "https://api.linkedin.com/v1/companies/id/shares?format=xml"); curl_setopt($objCurl, CURLOPT_HEADER, 1); //curl_setopt($objCurl, CURLOPT_POST, 1); curl_setopt($objCurl, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($objCurl, CURLOPT_POSTFIELDS, $strShare); //curl_setopt($objCurl, CURLOPT_HTTPHEADER, array( //'Content-Type: application/json', //'Connection: Keep-Alive' //)); curl_setopt($objCurl, CURLOPT_HTTPHEADER, array( 'Content-Type: application/xml', 'Connection: Keep-Alive' )); curl_setopt($objCurl, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($objCurl); curl_close($objCurl); echo $response; }
  2. this is good but how to check if Sathurday is working or not, and Monday is rest or not from the arrays?
  3. hello, i am printing the days with php: $i = 0; $date = 0; while ($i < 3) { $nexttime = strtotime("+$date days", strtotime("thursday")); if(date("D", $nexttime) == "Sat") { echo "saturday...skipping one day...<br />\n"; $date++; } else { echo "it's ".date("D", $nexttime)."<br />\n"; $i++; } $date++; } i am trying to check if the day is working or not, for this purpuse i have one table with two rows - arrays for working and rest days: ["11.02","03.06"...] this is the final result but .. something is wrong because today is working day but it was not printed: if((date("D",$nexttime)=="Sat" || (date("D",$nexttime)=="Sun") && !in_array(date("d.m",$nexttime),$workingdaysarray) ){$date++; ...
  4. there are many sites that take the coordinates without google, but they are very close to google coordinates. i tried some api but .. they are not so close. i ask this - is there a tool, web service, php, database that will give me the closest coordinates that give me google. in this case there wont be confirmation.
  5. so.. there is no way to take the coordinates without confirmation ?
  6. hello, i want to get the exact coordinates of IP address - latitude, longitude. i am using google geocode but it needs to confirm that you want to share the information. after that i tried other methods - ipinfodb.. and others api but they didnt give me the same coordinates as google. is there any way ?
  7. jazzman1, i wanted to create a way to save different information about different cities in one field, because when there are many users in one table, and if there are many information about cities for each user .. the rows will be much more. So in this way you have the whole information in one field:) Maybe there is and another way, but i dont know it.
  8. AbraCadaver thanks! i read that if i want to delete some array, i have to use unset($json->Sofia) for example.
  9. hello, i have on row in database with this: {"Sofia":["26","42.696693","23.302080"],"Lovetch":["13","43.140461","24.718996"]} to read the data, i use : .. $datasortarray=$row_info['seats_id']; $datasortarray=json_decode($datasortarray); foreach ($datasortarray as $key=>$row){ echo $key ; } first is the name of the city, every city has an array with data - number seats, latitude, longitude Can you please tell me how to add/delete other data to this array? if i have these input fields: <input name="city" type="text"> -> city name <input name="numbers" type="text"> -> for first number.. <input name="latitude" type="text"> -> for second number <input name="longitude" type="text"> -> for third number
  10. i rewrite the code based on jquery gmap and everything is ok.
  11. hello, i am using google scripts for finding the location base ot search city or street.. everything is working if i am searching from the same index by input tag with some id.. the button is executing some javascript. i am trying to make the search by giving parameter from other index - with $_GET['location']. after that i put one rule - if($_GET[location]){ echo "<script type javascript.. function()." but nothing happens. in the function i put one alert after the if(thislocation), to see if the parameter is givven to the function ant id is, but the location didnt appear. can you help me to understand what i am missing. function submitQuery(thislocation) { if(thislocation){var query=thislocation} else { var query = document.getElementById("location").value; } if (/\s*^\-?\d+(\.\d+)?\s*\,\s*\-?\d+(\.\d+)?\s*$/.test(query)) { var latlng = parseLatLng(query); if (latlng == null) { document.getElementById("location").value = ""; } else { geocode({ 'latLng': latlng }); } } else { geocode({ 'address': query }); } } function geocode(request) { resetMap(); var hash = ''; if (request.latLng) { hash = 'q=' + request.latLng.toUrlValue(6); } else { hash = 'q=' + request.address; } hashFragment = '#' + escape(hash); window.location.hash = escape(hash); geocoder.geocode(request, showResults); } function parseLatLng(value) { value.replace('/\s//g'); var coords = value.split(','); var lat = parseFloat(coords[0]); var lng = parseFloat(coords[1]); if (isNaN(lat) || isNaN(lng)) { return null; } else { return new google.maps.LatLng(lat, lng); } } <input type="text" id="location" style="width:93%; height:30px; font-size:15px;" class="logbut" placeholder="<?php echo $lang['mapinfo'];?>" > </td> <td align="right" style="min-width:46px; vertical-align:middle"> <input type="button" value="<?php echo $lang['search'];?>" class="newclassbutton" onclick="submitQuery()"/> <?php if($_GET['location']){?><script type="text/javascript">submitQuery('<?php echo $_GET['location'];?>')</script><?php } ?>
  12. hello , i have one database for users with coorinates - lat , longitude . i want to make something like - get nearest clients when you are accessing the site . i put geocode i the site , so when someone opens it , it give the coordinates . but how to get the nearest clients from the database , in distance 1 km for example . i search reverse geocoding , but i see it takes data from the site of google .. not from my database .
  13. Hello to all , i have some problems with mod_rewrite rules and i aks for help . i have working code that redirects domain.com/username/servicesid to domain.com/index.php?page=Profile&user=username&services_id=servicesid i want to make subdomain rewrite .. username.domain.com/servicesid to the same url domain.com/index.php?page=Profile&user=username&services_id=servicesid here is my code : RewriteRule ^([^/]+)/([a-z\d]{32})/(\d{4}-\d{2}-\d{2})$ index.php?page=Profile&user=$1&services_id=$2&date=$3 [L] RewriteRule ^([^/]+)/([a-z\d]{32})$ index.php?page=Profile&user=$1&services_id=$2 [L] RewriteCond %{REQUEST_FILENAME} !-f this is for rewriting only the subdomain : RewriteCond %{HTTP_HOST} !www.domain.com$ [NC] RewriteCond %{HTTP_HOST} ^(www.)?([^/]+).domain.com [NC] RewriteRule (.*) index.php?page=Profile&user=%2 [NC,QSA] can you please help me to make the code working . also when i open username.domain.com , i cannot open the css , js .. images files .
  14. hello , i use this maps api to visualise markers with coordinates from database : http://code.google.com/intl/bg/apis/maps/articles/phpsqlsearch.html i want to create a marker clusterer : http://gmaps-utility-library.googlecode.com/svn/trunk/markerclusterer/1.0/docs/examples.html but cannot understand how to write the code for my example - php/mysql . can you please help me .
  15. Hello, i am trying to make a calendar for different users which are described in the database. depending on the link to earn a calendar for the user. here's the code: $sql=" SELECT user , fullname FROM users "; $resource=mysql_query($sql) or die(mysql_error()); while($array=mysql_fetch_assoc($resource)) { $users[]=$array['user']; } if (isset($_GET['user'])) { $user = $_GET['user']; setcookie('user', $user, time()+(3600*24*365)); } elseif (isset($_COOKIE['user'])) { $user = $_COOKIE['user']; } else { $user = 'bg'; } if (!(in_array($user, array_keys($users)))) { die("Грешка: няма езиков файл!"); } require_once "{$user}.php"; function switch_users_options() { global $text, $users, $user; $retval = $text['switch']; $get = $_GET; foreach ($users as $abbrv => $name) { if ($abbrv !== $user) { $get['user'] = $abbrv; $url = $_SERVER['PHP_SELF'] . '?' . http_build_query($get); $retval .= " <a href=\"{$url}\"> {$name}</a><br>"; } } return $retval; } I've taken it from one code to change the language .. the question is that it displayed on new line - users from database but the links are wrong : index.php?user=0, user=1 .. user=2 not as it should be index.php?user=user1, user=test ... please for assistance.
  16. Hello , i am trying to start script for start/stoping services on remote server . I use this script : <?php if(isset($_POST['start'])) { exec('call scripts/start.cmd'); } ?> <input type="submit" value="Start" name="start" class="submit_button"> the start.cmd is : sc \\serverip start Spooler When i start the script for my machine Spooler service , everything is ok . (sc start Spooler) But when i want to start the spooler on another machine .. it doesn't start . I am administrator for the other machine . Can you help me ?
  17. when i displaced the different boxes , and when i hit Refresh button - the position and layout is the same , as before the refresh . I want when i move the boxes to different position and when i refresh the page .. the box to be in the new position .
  18. Hello , i use this cpanel - http://cpanel.demo.cpanel.net/frontend/x3/index.html?post_login=24429923374870 user/pass: x3demoa i want , when i displaced blocks, then refresh the page to save the last shift . can you help me with this ? i attached the files [attachment deleted by admin]
  19. .. i made it with case switch ($_POST['dropdown']) { case "business": $insert = mysql_query("INSERT INTO table (name, mail , address , comment) VALUES('$name', '$mail', '$address', '$comment')")or die(mysql_error()); break; .... } so thank you for the idea
  20. you want to say this : $insert = mysql_query("INSERT INTO $_POST['dropdown'] (name, mail , address , comment) VALUES('$name', '$mail', '$address', '$comment')")or die(mysql_error()); or not because now it says : Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /var/www/biznes/admin.php on line 73 .. the line where is $_POST
  21. Hello , I have one database with 6 same structure tables (only with different names). I want to put one dropdown menu to choose in wich table to insert the data . I have this code : <form action="" method="post"> <select name="dropdown"> <option>business</option> <option>design</option> <option >entertainment</option> <option >it</option> <option >lifestyle</option> <option >press</option> </select> <input class="input_text" type="text" name="name"> <input class="input_text" type="text" name="mail"> <input class="input_text" type="text" name="address"> <textarea class="input_textarea" name="comment"></textarea> <input type="submit" name="submit" value="Изпрати" class="button"> </form> <?php if (isset($_POST["submit"])) { $dbhost = "localhost"; $dbuser = ""; $dbpass = ""; $dbname = ""; $conn = mysql_connect($dbhost, $dbuser, $dbpass)or die(mysql_error()); mysql_select_db($dbname, $conn)or die(mysql_error()); if (!empty($_POST["name"])) $name = htmlspecialchars($_POST["name"]); else $errMsg = " <a class=maintext2><font color=#000000>please write name!</font></a><br />"; if (!empty($_POST["mail"])) $mail = htmlspecialchars($_POST["mail"]); else $errMsg = "<a class=maintext2><font color=#000000>please write e-mail!</font></a><br />"; if (!empty($_POST["address"])) $address = htmlspecialchars($_POST["address"]); else $errMsg = "<a class=maintext2><font color=#000000>please write address!</font></a><br />"; if (!empty($_POST["comment"])) $comment = htmlspecialchars($_POST["comment"]); else $errMsg = "<a class=maintext2><font color=#000000>please write message!</font></a><br />"; if (empty($errMsg)) { $insert = mysql_query("INSERT INTO $dropdown(name, mail , address , comment) VALUES('$name', '$mail', '$address', '$comment')")or die(mysql_error()); echo '<a class=maintext2><font color=#000000> message send!</font></a><br />'; } else echo $errMsg; mysql_close(); } ?> Can you help me with this code ? thank you
×
×
  • 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.