Solved

$_GET call between URL

Posted on 2017-04-04
3
69 Views
Last Modified: 2017-04-04
<?php
if( $_GET["shortcode"]) {
$api = file_get_contents("https://api.instagram.com/oembed/?url=http://instagram.com/p/"$_GET["shortcode"]"/");      
$apiObj = json_decode($api,true);      
$media_id = $apiObj['media_id'];
echo $_GET["shortcode"];
}

Open in new window


it not work . how can i call $_GET between URL
http://instagram.com/p/"$_GET["shortcode"]"/");

Open in new window

0
Comment
Question by:Mehran Goudarzi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 8

Expert Comment

by:Leonidas Dosas
ID: 42077653
Try with isset function:

if(isset( $_GET["shortcode"])){
//code here...
}

Open in new window

0
 
LVL 4

Accepted Solution

by:
Peos John earned 500 total points
ID: 42077660
You need to add dot(.) to concat the string, Please check the below line.

$api = file_get_contents("https://api.instagram.com/oembed/?url=http://instagram.com/p/".$_GET["shortcode"]."/");      

Open in new window

1
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 42077898
If you're new to PHP and want some good learning resources, this article can help.
https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Extract data from output with RegEx 1 41
How do I add date to text file name 15 30
Change background images after 5 seconds. 12 48
Joomla Editing 3 23
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question